Skip to content

Intermittent fetch cache failing build on seemingly succesful request #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NicholasG04 opened this issue May 1, 2025 · 1 comment
Labels
need reproduction This issue need a reproduction in order to be fixed

Comments

@NicholasG04
Copy link

Sometimes, but often repeatably for a period of time (unsure why), our fetch calls fail at build time. The error message seems to imply the data is being returned fine, so can't understand why this only happens occasionally. Thanks.

┌──────────────────────────────┐
│ OpenNext — Generating bundle │
└──────────────────────────────┘

Bundling middleware function...
Bundling static assets...
Bundling cache assets...
undefined:1
{"kind":"FETCH","data":{"headers":{"accept-ranges":"bytes","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","apicdn-cache-control":"public, max-age=60, s-maxage=3600, stale-while-revalidate=60, stale-if-error=3600","cache-control":"public, max-age=60, s-maxage=60, stale-while-revalidate=15, stale-if-error=3600","content-encoding":"br","content-length":"187","content-type":"application/json; charset=utf-8","date":"Tue, 29 Apr 2025 19:26:15 GMT","sanity-gateway":"k8s-gcp-us-e4-prod-ing-02","sanity-query-hash":"X1GR0w26rA4 nyN2XmeKrzc","server-timing":"api;dur=7","strict-transport-security":"max-age=63072000; includeSubDomains; preload","vary":"accept-encoding, origin","via":"1.1 google","x-sanity-age":"0","x-sanity-shard":"gcp-eu-w1-01-prod-1034"},"body":"eyJyZXN1bHQiOlt7ImN1cnJlbmN5Y29kZSI6IkVVUiJ9XSwicmVzdWx0U291cmNlTWFwIjp7ImRvY3VtZW50cyI6W3siX2lkIjoiZmVlNDU0MmItMzA4NC00OTY4LWEyOWYtY2NhMTM3NGFkMDJjIiwiX3R5cGUiOiJyZWdpb24ifV0sInBhdGhzIjpbIiRbJ2N1cnJlbmN5Y29kZSddIl0sIm1hcHBpbmdzIjp7IiRbMF1bJ2N1cnJlbmN5Y29kZSddIjp7InNvdXJjZSI6eyJkb2N1bWVudCI6MCwicGF0aCI6MCwidHlwZSI6ImRvY3VtZW50VmFsdWUifSwidHlwZSI6InZhbHVlIn19fSwic3luY1RhZ3MiOlsiczE6U0QzeW1RIl0sIm1zIjoxfQ==","status":200,"url":"**REMOVED**","revalidate":86400,"tags":[]}]}

SyntaxError: Unexpected token ] in JSON at position 1473
    at JSON.parse (<anonymous>)
    at file:///home/runner/.npm/_npx/d1d80c683aba60d6/node_modules/@opennextjs/aws/dist/build.js:432:39
    at file:///home/runner/.npm/_npx/d1d80c683aba60d6/node_modules/@opennextjs/aws/dist/build/helper.js:118:13
    at Array.forEach (<anonymous>)
    at traverseFiles (file:///home/runner/.npm/_npx/d1d80c683aba60d6/node_modules/@opennextjs/aws/dist/build/helper.js:111:51)
    at createCacheAssets (file:///home/runner/.npm/_npx/d1d80c683aba60d6/node_modules/@opennextjs/aws/dist/build.js:430:13)
    at build (file:///home/runner/.npm/_npx/d1d80c683aba60d6/node_modules/@opennextjs/aws/dist/build.js:56:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/runner/.npm/_npx/d1d80c683aba60d6/node_modules/@opennextjs/aws/dist/index.js:9:1
@khuezy
Copy link
Contributor

khuezy commented May 1, 2025

Can you open the build.js file and look at line 432?
https://github.dev/opennextjs/opennextjs-aws/tree/main/packages/open-next/src/helpers

It looks like it's trying to parse JSON of a file?

Are you running multiple builds at once that may wipe some of the .json files?

@conico974 conico974 added the need reproduction This issue need a reproduction in order to be fixed label May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need reproduction This issue need a reproduction in order to be fixed
Projects
None yet
Development

No branches or pull requests

3 participants