next.js: Deploying to AWS EB now causes a permission issue?

Bug report

Describe the bug

I have been able to install and run NextJS in Elastic Beanstalk previously, but now I get the following error; I do have a .npmrc with unsafe-perm=true in though so I should be installing as root - is the file present that it says it cannot access?

> Build error occurred
{ Error: EACCES: permission denied, open '/tmp/.config/nextjs-nodejs/config.json'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Conf.get store [as store] (/var/app/current/node_modules/conf/index.js:228:18)
    at new Conf (/var/app/current/node_modules/conf/index.js:92:26)
    at new Telemetry (/var/app/current/node_modules/next/dist/telemetry/storage.js:22:424)
    at build (/var/app/current/node_modules/next/dist/build/index.js:3:323)
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/tmp/.config/nextjs-nodejs/config.json' }

To Reproduce

The next 9.1.2 package should install like 9.1.1 does.

Expected behavior

The deployment should work, as it does with 9.1.1

System information

  • Version of Next.js: [9.1.2]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

As a fix for now I was able to get it working by adding the following to .ebextensions/00_permissions.config

files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/00_permissions.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      chown -R nodejs:nodejs /tmp/.npm
      chown -R nodejs:nodejs /tmp/.config

Requiring root to install doesn’t really feel solution, it feels like a workaround the actual problem - something changed in the version release.