cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.18k stars 109 forks source link

[πŸ› Bug]: error code: 1016 #801

Open martian0x80 opened 1 month ago

martian0x80 commented 1 month ago

next-on-pages environment related information

System:
    Platform: linux
    Arch: x64
    Version: #1 SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:45 +0000
    CPU: (4) x64 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz
    Memory: 7 GB
    Shell: /usr/bin/zsh
Package Manager Used: npm (10.8.1)

Relevant Packages:
    @cloudflare/next-on-pages: 1.11.3
    vercel: 34.2.3
    next: 14.2.3

Description

Hi, so, I have been trying to migrate a site from Vercel to CF pages, but it's a new problem at every step, first was an issue with the bun version that cf uses, and now this.

Ran npx @cloudflare/next-on-pages@latest without any serious warnings or errors. After deployment, I got a Application error: a client-side exception has occurred (see the browser console for more information).

Then checked the runtime logs with npx wrangler pages deployment tail, which gives me

GET https://mydomain/ - Ok @ 6/9/2024, 2:59:49 PM
  (error) error code: 1016
  (error) SyntaxError: Unexpected token 'e', "error code: 1003" is not valid JSON
  (error) SyntaxError: Unexpected token 'e', "error code: 1003" is not valid JSON

Can't make any external API requests from the site. So, I started wrangler dev locally with npx wrangler pages dev .vercel/output/static, and this is what I get everytime,

[wrangler:inf] GET /student/01096202722 200 OK (2069ms)
✘ [ERROR] workerd/jsg/util.c++:251: error: e = kj/async-io-unix.c++:1298: failed: DNS lookup failed.; params.host = internal_suspense_cache_hostname.local; params.service = ; gai_strerror(status) = Name or service not known

  stack:
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@57da5cc
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@57dafe0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@3fb3790
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@410b810
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@410d290
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@410d9f0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@4121040
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@33d9546
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2de5310
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@357f4f0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@35797f0;
  sentryErrorContext = jsgInternalError

✘ [ERROR] workerd/jsg/util.c++:251: error: e = kj/async-io-unix.c++:1298: failed: DNS lookup failed.; params.host = internal_suspense_cache_hostname.local; params.service = ; gai_strerror(status) = Name or service not known

  stack:
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@57da5cc
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@57dafe0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@3fb3790
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@410b810
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@410d290
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@410d9f0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@4121040
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@33d9546
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2de5310
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@357f4f0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@35797f0;
  sentryErrorContext = jsgInternalError

✘ [ERROR] A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.

✘ [ERROR] workerd/server/server.c++:3346: error: Uncaught exception: workerd/io/io-context.c++:1167: failed: remote.jsg.Error: The script will never generate a response.

  stack:
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@338c5c0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@338dbb0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@338e460
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@33d935d
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2de5310
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@411945b
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@579deef
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@4117ba0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2ddb010
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@37d3f00
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@3509cf0
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@350a124
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@579deef
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@338e460
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2e0185c
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@412c087
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@412d20b
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@412dbec
  /home/martian/.npm/_npx/32026684e21afda6/node_modules/@cloudflare/workerd-linux-64/bin/workerd@40f0160

✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.

I added a comment on an issue that looks similar in the workerd repo here.

I am not sure if the local errors (in wrangler dev) are related to the one in the deployment, so does anyone have any clue?

Reproduction

No response

Pages Deployment Method

Pages CI (GitHub/GitLab integration)

Pages Deployment ID

No response

Additional Information

No response

Would you like to help?

martian0x80 commented 1 month ago

Fixed: It was just a DNS issue on my machine, And a coincidence that an ENV var needed updating on the cf pages project.

martian0x80 commented 1 month ago

Nvm, still a DNS issue with cloudflare workers. I randomly get a client side exception just like I do on localhost because of the DNS issues.