Next JS Failed to update prerender cache EACCES: permission denied

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: