Re-deploy my nodejs app and sadly got crashed.


I did this yesterday, it’s still okay, I don’t know why it crashed today in this Error
" Error: EACCES: permission denied, mkdir ‘/layers/heroku_nodejs-npm-install’"
and this is my fly.toml:

Could someone help me that?

Added nodejs

I’ve realized this issue is not caused by this platform, while issue exists on image,
Fianlly, I decide to make an image by myself as demonstrated below:


and remove my build section of fly.toml
It’s also worked.

I’ve just started getting this exact same issue. In my fly.toml

[build]
  builder = "heroku/buildpacks:20"

[build.args]
  PORT = "8080"
  NODE_ENV = "production"

This was working fine 2 weeks ago, and now it no longer works. It will build and deploy, but the machine/app won’t start up, getting same start up errors per your screenshot.

I feel like something has changed with the buildpacks?

I have the same issue.

  Configuring firecracker
  [    0.048879] PCI: Fatal: No config space access function found
   INFO Starting init (commit: 913ad9c)...
   INFO Preparing to run: `launcher npm run db:migrate:latest:prod` as heroku
   INFO [fly api proxy] listening at /.fly/api
  2024/03/04 10:56:23 listening on [fdaa:0:be54:a7b:fd:6ea2:a139:2]:22 (DNS: [fdaa::3]:53)
  Machine created and started in 21.074s
  > controller@1.0.0 db:migrate:latest:prod
  > knex --knexfile ./knexfile.cjs migrate:latest
  Using environment: production
  npm ERR! code EACCES
  npm ERR! syscall mkdir
  npm ERR! path /layers/heroku_nodejs-npm-install
  npm ERR! errno -13
  npm ERR! Error: EACCES: permission denied, mkdir '/layers/heroku_nodejs-npm-install'
  npm ERR!  [Error: EACCES: permission denied, mkdir '/layers/heroku_nodejs-npm-install'] {
  npm ERR!   errno: -13,
  npm ERR!   code: 'EACCES',
  npm ERR!   syscall: 'mkdir',
  npm ERR!   path: '/layers/heroku_nodejs-npm-install'
  npm ERR! }

I really don’t want to maintain my own dockerfile. It feels like this is one of the reasons to use Fly, so I don’t have to mess about with that. Why can’t I just deploy like I could a few days ago?

I am getting this same issue, my app has been working fine and suddenly started getting this error.

Anyone found a workaround on this yet? I am facing the same issue.

Hi @loldedmded

Are you using a buildpack? We created an open source project that during fly launch creates a custom Dockerfile without you having to worry about anything.

In case you app already exists try running npx --yes @flydotio/dockerfile@latest and removing the buildpack from your fly.toml from [build] and try deploying it again.

Here’s all options and source code for our Dockerfile generator GitHub - fly-apps/dockerfile-node: Dockerfile generator for Node.js

arg, seems I also got hit by that

how can I fix that,

I do not fully understand that:

in case you app already exists try running npx --yes @flydotio/dockerfile@latest and removing the buildpack from your fly.toml from [build] and try deploying it again.

So I, too, was part of the Great Heroku Migration in late 2022 and only ran into these issues today (after ignoring the deprecation warnings for months, I think). Before I go into the step-by-step of how this worked for me, I want to say being able to roll back to the latest working image was very comforting, so I’ll mention that first.

First I grabbed the latest working image using this CLI: flyctl releases --image

I got the image ID from the right hand side, it will look like registry.fly.io/<your_app>@sha256:475309457929234782760586795467920762

Then I used this command to roll back to that image:
flyctl deploy -i registry.fly.io/<my_app>@sha256:<longUID>

To move forward with a NEW deployment, this worked for me (getting the exact same error as above).

  1. Navigate to the file folder containing your fly.toml. I have another file here called Dockerfile.
  2. Copy the contents of Dockerfile over to somewhere else (just to be safe).
  3. Run npx --yes @flydotio/dockerfile@latest in this directory from the CLI.
  4. It will run into the issue of Dockerfile already existing. It will ask for permission to overwrite it. Type y and hit enter.
  5. Once it finishes, go to your fly.toml and remove the line under [build].

So this:

[build]
  builder = "heroku/buildpacks:20"

will become this (yes I left a line intentionally blank!):

[build]

  1. Then deploy your app (for me this is flyctl deploy -a <my_app>)

My app is pretty simple, so this worked for me. I hope this helps someone!

4 Likes

FYI: if you rename your new Dockerfile to something like Dockerfile.fly, you can put the original Dockerfile back and tell fly which one to use by setting the name in your fly.toml:

Thank you, I was already losing it. These steps worked perfectly for me as well!