When building the app, getting: EACCES: permission denied

Using Gatsby and the app had been building successfully for many months. But starting from about 2 weeks ago the app no longer builds. It seems that Gatsby build completes successfully, but the build fails trying to move generated assets.

The exact error from the logs:
Cannot copy from public/1088-5db2239f0764d57a4137.js to /opt/build/cache/cwd/public/1088-5db2239f0764d57a4137.js: Cannot create directory /opt/build/cache/cwd/public: EACCES: permission denied, mkdir ‘/opt/build/cache’

Any ideas how to deal with it?
Thank you

Can you provide a deployment ID for a build this happened to?

And did you make any other changes before this started to happen? Update Gatsby or anything?

Here is a link to the latest failed deployment attempt: https://dash.cloudflare.com/f1113781a43ee04ef4de7ff221496886/pages/view/appichiorg/806a81e1-8779-4380-83f4-a3500c9b8159

Initially we tried to upgrade Gatsby from 5.11 to 5.12, but rolled it back and tried both options - with the same problem.

A few packages that got really updated were: wagmi (from 1.3.8 to 1.4.1), viem (from 1.5.3 to 1.10.9) and @rainbow-me/rainbowkit (from 1.0.8 to 1.0.11)

Hey,

Can you try the v2 build system - https://dash.cloudflare.com/?to=/:account/pages/view/:pages-project/settings/builds-deployments → “Build system version” → v2

If the issue persists, please provide the deployment ID (the UUID in the URL when viewing a deployment in the dash)

I already tried using V2, the build failed there with different problem: /bin/sh: 1: gatsby: not found
That attempt is here: 95e0f95d-52a6-4dd3-8090-a9a3d0bab185

ID of a failed deployment with the primary/original problem is this: 806a81e1-8779-4380-83f4-a3500c9b8159

Tried on V2 with “npx gatsby build”. It failed with the original problem: Error: EACCES: permission denied, mkdir ‘/opt/build/cache’

Looks like it doesn’t matter whether it’s V1 or V2 for this problem.

Deployment ID: 48ffa445-4008-4a16-b56c-e3d6cb476812

This deployment is still using v1
image

You may have changed it for prod but not preview?

You are right. It started to work on V2.
Something must have happened to V1 image…
We’ll switch to V2

Thank you

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