Closed hjaber closed 1 year ago
Thanks a lot for the issue @hjaber (and thanks a lot for the reproduction! π)
It turns out that the solution in the PR had a typo and instead of !==
I put there ===
π
@hjaber if you want you can check the beta release: https://www.npmjs.com/package/@cloudflare/next-on-pages/v/0.0.0-9f5b83c should be all good now π (and I'll probably do a proper release later today or tomorrow)
Thank you again @dario-piotrowicz for your prompt fix!
Still getting a build error, should I be manually adding the following to my wrangler.toml file?
Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.
2023-04-25T14:37:56.065216Z Cloning repository...
2023-04-25T14:37:57.115052Z From https://github.com/hjaber/mech
2023-04-25T14:37:57.115708Z * branch d74842e13ec16b81561176acf9a3855ffb9980c4 -> FETCH_HEAD
2023-04-25T14:37:57.115955Z
2023-04-25T14:37:57.171586Z HEAD is now at d74842e demo @cloudflare/next patch
2023-04-25T14:37:57.172255Z
2023-04-25T14:37:57.280249Z
2023-04-25T14:37:57.311722Z Success: Finished cloning repository files
2023-04-25T14:37:58.026135Z Installing dependencies
2023-04-25T14:37:58.03377Z Python version set to 2.7
2023-04-25T14:38:01.26297Z v18.16.0 is already installed.
2023-04-25T14:38:02.722578Z Now using node v18.16.0 (npm v9.5.1)
2023-04-25T14:38:02.898793Z Started restoring cached build plugins
2023-04-25T14:38:02.910945Z Finished restoring cached build plugins
2023-04-25T14:38:03.302073Z Attempting ruby version 2.7.1, read from environment
2023-04-25T14:38:04.774126Z Using /opt/buildhome/.rvm/gems/ruby-2.7.1
2023-04-25T14:38:05.772344Z Using PHP version 5.6
2023-04-25T14:38:05.86246Z 5.2.5 is already installed.
2023-04-25T14:38:05.879224Z Using Swift version 5.2.5
2023-04-25T14:38:05.880063Z Started restoring cached node modules
2023-04-25T14:38:05.891341Z Finished restoring cached node modules
2023-04-25T14:38:06.752439Z Installing NPM modules using NPM version 9.5.1
2023-04-25T14:38:12.752478Z npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2023-04-25T14:38:13.46445Z npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2023-04-25T14:38:15.580287Z npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
2023-04-25T14:38:27.949063Z
2023-04-25T14:38:27.949577Z added 1011 packages, and audited 1012 packages in 20s
2023-04-25T14:38:27.949799Z
2023-04-25T14:38:27.949942Z 246 packages are looking for funding
2023-04-25T14:38:27.950065Z run `npm fund` for details
2023-04-25T14:38:27.967631Z
2023-04-25T14:38:27.968045Z 3 moderate severity vulnerabilities
2023-04-25T14:38:27.968196Z
2023-04-25T14:38:27.968323Z To address all issues (including breaking changes), run:
2023-04-25T14:38:27.968433Z npm audit fix --force
2023-04-25T14:38:27.96854Z
2023-04-25T14:38:27.968744Z Run `npm audit` for details.
2023-04-25T14:38:27.990855Z NPM modules installed
2023-04-25T14:38:28.056883Z Installing Hugo 0.54.0
2023-04-25T14:38:28.718354Z Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
2023-04-25T14:38:28.723188Z Started restoring cached go cache
2023-04-25T14:38:28.738751Z Finished restoring cached go cache
2023-04-25T14:38:28.828169Z go version go1.14.4 linux/amd64
2023-04-25T14:38:28.841865Z go version go1.14.4 linux/amd64
2023-04-25T14:38:28.846622Z Installing missing commands
2023-04-25T14:38:28.846911Z Verify run directory
2023-04-25T14:38:28.847063Z Executing user command: npx @cloudflare/next-on-pages --experimental-minify
2023-04-25T14:38:30.714627Z β‘οΈ @cloudflare/next-on-pages CLI v.0.0.0-9f5b83c (beta/canary release)
2023-04-25T14:38:30.717201Z β‘οΈ Detected Package Manager: npm
2023-04-25T14:38:30.71748Z β‘οΈ Preparing project...
2023-04-25T14:38:30.720104Z β‘οΈ Project is ready
2023-04-25T14:38:30.720342Z β‘οΈ Building project...
2023-04-25T14:38:32.100977Z β² Vercel CLI 28.20.0
2023-04-25T14:38:32.409812Z β² Installing dependencies...
2023-04-25T14:38:34.689366Z β² up to date in 2s
2023-04-25T14:38:34.68983Z β² 246 packages are looking for funding
2023-04-25T14:38:34.690363Z β² run `npm fund` for details
2023-04-25T14:38:34.70505Z β² Detected Next.js version: 13.3.1
2023-04-25T14:38:34.713694Z β² Detected `package-lock.json` generated by npm 7+...
2023-04-25T14:38:34.714164Z β² Running "npm run build"
2023-04-25T14:38:35.549244Z β² > mech@0.1.0 build
2023-04-25T14:38:35.549573Z β² > next build
2023-04-25T14:38:36.110686Z β² warn - You have enabled experimental feature (appDir) in next.config.js.
2023-04-25T14:38:36.111411Z β² warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
2023-04-25T14:38:36.111686Z β² info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
2023-04-25T14:38:36.146461Z β² Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-04-25T14:38:36.1468Z β² This information is used to shape Next.js' roadmap and prioritize features.
2023-04-25T14:38:36.147022Z β² You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
2023-04-25T14:38:36.147317Z β² https://nextjs.org/telemetry
2023-04-25T14:38:36.314396Z β² info - Creating an optimized production build...
2023-04-25T14:38:36.519428Z β² warn - You are using an experimental edge runtime, the API might change.
2023-04-25T14:38:48.10533Z β² info - Compiled successfully
2023-04-25T14:38:48.109136Z β² info - Linting and checking validity of types...
2023-04-25T14:38:50.605343Z β² info - Collecting page data...
2023-04-25T14:39:02.830727Z β² info - Generating static pages (0/3)
2023-04-25T14:39:02.960116Z β² info - Generating static pages (3/3)
2023-04-25T14:39:02.972917Z β² info - Finalizing page optimization...
2023-04-25T14:39:02.978136Z β²
2023-04-25T14:39:02.991094Z β² Route (app) Size First Load JS
2023-04-25T14:39:02.991341Z β² β β / 257 B 76 kB
2023-04-25T14:39:02.991482Z β² β β /api/hello 0 B 0 B
2023-04-25T14:39:02.991603Z β² β β /favicon.ico 0 B 0 B
2023-04-25T14:39:02.991725Z β² + First Load JS shared by all 75.8 kB
2023-04-25T14:39:02.991954Z β² β chunks/139-f16e2247630ddfd5.js 23.3 kB
2023-04-25T14:39:02.992156Z β² β chunks/2443530c-df1bed786c221046.js 50.6 kB
2023-04-25T14:39:02.992372Z β² β chunks/main-app-b5b471d2d5990a4e.js 211 B
2023-04-25T14:39:02.992589Z β² β chunks/webpack-d865449db0df187c.js 1.68 kB
2023-04-25T14:39:02.992802Z β²
2023-04-25T14:39:02.993022Z β² Route (pages) Size First Load JS
2023-04-25T14:39:02.993175Z β² β β /404 178 B 87.1 kB
2023-04-25T14:39:02.993294Z β² + First Load JS shared by all 86.9 kB
2023-04-25T14:39:02.993404Z β² β chunks/main-b5f0d8ee971aa431.js 85.1 kB
2023-04-25T14:39:02.993509Z β² β chunks/pages/_app-c544d6df833bfd4a.js 192 B
2023-04-25T14:39:02.993614Z β² β chunks/webpack-d865449db0df187c.js 1.68 kB
2023-04-25T14:39:02.993731Z β² β (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components)
2023-04-25T14:39:02.993859Z β² β (Static) automatically rendered as static HTML (uses no initial props)
2023-04-25T14:39:07.316935Z β² Traced Next.js server files in: 3.594s
2023-04-25T14:39:09.199025Z β² Created all serverless functions in: 1.882s
2023-04-25T14:39:09.387271Z β² Collected static files (public/, static/, .next/static): 6.95ms
2023-04-25T14:39:10.340255Z β² Build Completed in .vercel/output [38s]
2023-04-25T14:39:10.45724Z β‘οΈ Completed `npx vercel build`.
2023-04-25T14:39:11.472529Z β‘οΈ Generated '.vercel/output/static/_worker.js'.
2023-04-25T14:39:11.512154Z Finished
2023-04-25T14:39:11.512752Z Found _worker.js in output directory. Uploading.
2023-04-25T14:39:12.360143Z [31mβ [41;31m[[41;97mERROR[41;31m][0m [1m1 error(s) and 0 warning(s) when compiling Worker.[0m
2023-04-25T14:39:12.36093Z
2023-04-25T14:39:12.361545Z
2023-04-25T14:39:12.364346Z
2023-04-25T14:39:12.366095Z [31mβ [41;31m[[41;97mERROR[41;31m][0m [1mCould not resolve "node:buffer"[0m
2023-04-25T14:39:12.366852Z
2023-04-25T14:39:12.367031Z _worker.js:2:2565:
2023-04-25T14:39:12.367168Z [37m 2 β ...ar mr={};import*as e2 from[32m"node:buffer"[37m;var cc=Te(()=>{B();H();g...
2023-04-25T14:39:12.36732Z β΅ [32m~~~~~~~~~~~~~[0m
2023-04-25T14:39:12.367927Z
2023-04-25T14:39:12.36813Z The package "node:buffer" wasn't found on the file system but is built into node.
2023-04-25T14:39:12.368307Z Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.
2023-04-25T14:39:12.368426Z
2023-04-25T14:39:12.368639Z
2023-04-25T14:39:12.368795Z [31mβ [41;31m[[41;97mERROR[41;31m][0m [1mBuild failed with 1 error:[0m
2023-04-25T14:39:12.368911Z
2023-04-25T14:39:12.369028Z _worker.js:2:2565: ERROR: Could not resolve "node:buffer"
2023-04-25T14:39:12.369149Z
2023-04-25T14:39:12.369261Z
2023-04-25T14:39:12.380787Z Failed building Pages Functions.
2023-04-25T14:39:13.294938Z Failed: an internal error occurred
Thank you again @dario-piotrowicz for your prompt fix! @hjaber my pleasure, it was my dumb mistake that cause the issue in the first place after all π
@hjaber dang, I'm sorry things are still not working for you, what you're seeing is quite weird!
from your logs (import*as e2 fromοΏ½[32m"node:buffer"
) I can see that the import is correctly converted now, so that's good at least
Regarding the issue you're facing I think it is an issue with wrangler/pages in general and that it needs to be fixed upstream, but I'll investigate (so I reopened the issue)
You definitely should not need a wrangler.toml
file for your Pages application but you could try to add one with the nodejs_compat flag just to see if that for some reason fixes the bug temporarily until we fix the upstream issue (just trying that can't hurt π)
PS: I just tried adding a wrangler.toml
file doesn't seem to help in any way, the message might be just misleading
PS: I just tried adding a
wrangler.toml
file doesn't seem to help in any way, the message might be just misleading
I had the same result. As far as I can tell, I'm using default settings and it is more or less a fresh install so nothing stands out as strange to me. I appreciate your help in triaging the issue and updating it
@hjaber sorry it's taking a while, we're working on it π
Not ideal but until my PR gets merged you can just use the prerelease (https://github.com/cloudflare/workers-sdk/pull/3133#issuecomment-1533440046) to manually deploy your app (making sure that you've got nodejs_compat
set in the dashboard)
Hello @dario-piotrowicz , do you have an ETA when your fix will be merged into production ?
@atali my fix already got merged so if you use wrangler 2.20.0 you should be able to deploy with that π (granted that you've added the nodejs_compat
flag for your project)
If you want to use the Pages github integration that needs also the Pages build image update to be released, I think it should happen tomorrow, I'll let know you when it is π
I was talking to deploy from the Clouflare Pages website. Thank you so much @dario-piotrowicz
@atali ah ok :slightly_smiling_face:, I just checked and tested it out and the CI build image has been updated and the automatic deployment works fine now :slightly_smiling_face::+1:
It works ! you rocks :-)
@atali ah ok :slightly_smiling_face:, I just checked and tested it out and the CI build image has been updated and the automatic deployment works fine now :slightly_smiling_face::+1:
Thank you for following through on this issue!
@hjaber no problem :slightly_smiling_face:
(PS: please try not to use the latest beta release as we're currently having some issues there :sweat: https://github.com/cloudflare/next-on-pages/issues/54#issuecomment-1543888672, 0.10.1 should work as expected :slightly_smiling_face:)
I can confirm that I'm able to run locally, and on CF Pages with the follow deps versions:
"@cloudflare/next-on-pages": "0.10.1",
"next": "13.4.2",
"vercel": "29.3.0",
"wrangler": "2.20.0"
I know this issue is titled NextJS v13.3.1, but it was created when that was the latest, now NextJS is up to v13.4.2
Sadly the bug still persists for @sveltejs/adapter-cloudflare
:( Glad. you managed to solve it for Next.
Cli version
0.10.0
next-on-pages environment related information
Description
I see that issue #186 is already merged but I'm having this exception thrown in prod
Error 1101 Worker threw exception
Reproduction
https://github.com/hjaber/mech
Additional Information
No response
Would you like to help?