Next JS Failed to update prerender cache EACCES: permission denied

I am using next js , getting below mentioned error in the machine on Fly v2.

2023-06-07T06:20:30.753 app[148e66ef393989] sin [info] Failed to update prerender cache for /contact [Error: EACCES: permission denied, open '/app/.next/server/pages/contact.html'] {

2023-06-07T06:20:30.753 app[148e66ef393989] sin [info] errno: -13,

2023-06-07T06:20:30.753 app[148e66ef393989] sin [info] code: 'EACCES',

2023-06-07T06:20:30.753 app[148e66ef393989] sin [info] syscall: 'open',

2023-06-07T06:20:30.753 app[148e66ef393989] sin [info] path: '/app/.next/server/pages/contact.html'

2023-06-07T06:20:30.753 app[148e66ef393989] sin [info] }

Toml File

# fly.toml app configuration file generated for cakeiy on 2023-06-05T14:55:08+05:30
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "my-fave-app852"
primary_region = "cdg"
[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1

[env]
#env variable list defined here

It seems like you’re encountering a permission issue when trying to update the prerender cache for the /contact page in your Next.js application on Fly.io. The error message indicates that the process does not have the necessary permissions to access or modify the file /app/.next/server/pages/contact.html.

To resolve this issue, you can try the following steps:

  1. Ensure that the /app/.next/server/pages directory and its contents have the correct permissions. You can set the permissions using the chmod command. For example, you can grant read, write, and execute permissions to the owner, group, and others for the directory and its contents (please also refer to the linked posts below in More Info):
chmod -R 777 /app/.next/server/pages
  1. If you’re using a custom build script or configuration, make sure that the output directory for the prerendered pages is set correctly and has the appropriate permissions.

More info:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.