# Release command failed; timed out trying to acquire postgres advisory lock

**URL:** <https://community.fly.io/t/release-command-failed-timed-out-trying-to-acquire-postgres-advisory-lock/5344>\
**Category:** Questions / Help\
**Created:** [May 26, 2022, 4:47am UTC](https://community.fly.io/t/release-command-failed-timed-out-trying-to-acquire-postgres-advisory-lock/5344 "2022-05-26T04:47:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rnz269](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rnz269/32/3064_2.png) [@rnz269](https://community.fly.io/u/rnz269)\
**Post date:** [May 26, 2022, 4:47am UTC](https://community.fly.io/t/release-command-failed-timed-out-trying-to-acquire-postgres-advisory-lock/5344/1 "2022-05-26T04:47:53Z")

</div>

For the past four hours, I’ve been encountering a strange issue where my linting, unit tests, E2E tests, and build pass but the deployment fails.

 ![flyiodeploymentissue](https://global.discourse-cdn.com/fly1/original/3X/2/8/287851879801fc2ebced90a65a9eff095992b22a.png)

Here’s my toml file

```auto
app = "hellotrava"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
PORT = "8080"
PRIMARY_REGION = "ewr"

[deploy]
release_command = "npx prisma migrate deploy"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []

  [services.concurrency]
  hard_limit = 25
  soft_limit = 20
  type = "connections"

  [[services.ports]]
  handlers = ["http"]
  port = "80"
  force_https = true

  [[services.ports]]
  handlers = ["tls", "http"]
  port = "443"

  [[services.tcp_checks]]
  grace_period = "1s"
  interval = "15s"
  restart_limit = 0
  timeout = "2s"

  [[services.http_checks]]
  interval = 10000
  grace_period = "5s"
  method = "get"
  path = "/"
  protocol = "http"
  timeout = 2000
  tls_skip_verify = false
  headers = { }

```

And here’s my dockerfile

```auto
# base node image
FROM node:16-bullseye-slim as base

# set for base and all layer that inherit from it
ENV NODE_ENV production

# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl

# Install all node_modules, including dev dependencies
FROM base as deps

WORKDIR /myapp

ADD package.json package-lock.json ./
RUN npm install --production=false

# Setup production node_modules
FROM base as production-deps

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD package.json package-lock.json ./
RUN npm prune --production

# Build the app
FROM base as build

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules

ADD prisma .
RUN npx prisma generate

ADD . .
RUN npm run postinstall
RUN npm run build

# Finally, build the production image with minimal footprint
FROM base

WORKDIR /myapp

COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY --from=build /myapp/node_modules/.prisma /myapp/node_modules/.prisma

COPY --from=build /myapp/build /myapp/build
COPY --from=build /myapp/public /myapp/public
ADD . .

CMD ["npm", "start"]

```

---

<div class="post-metadata">

**Author:** ![rnz269](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rnz269/32/3064_2.png) [@rnz269](https://community.fly.io/u/rnz269)\
**Post date:** [May 26, 2022, 4:49pm UTC](https://community.fly.io/t/release-command-failed-timed-out-trying-to-acquire-postgres-advisory-lock/5344/2 "2022-05-26T16:49:12Z")

</div>

I was confident that these changes weren’t breaking, so I merged into main which deployed to production. The production deployment succeeded without any issues.

Still not sure why the staging database is having issues.

---

<div class="post-metadata">

**Author:** ![lucas-curti](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lucas-curti](https://community.fly.io/u/lucas-curti)\
**Post date:** [September 5, 2022, 6:27pm UTC](https://community.fly.io/t/release-command-failed-timed-out-trying-to-acquire-postgres-advisory-lock/5344/3 "2022-09-05T18:27:23Z")

</div>

having the exact same issue. Did you find the cause of it? 🙏
