CLI to build and develop Next.js apps for Cloudflare Pages
### next-on-pages environment related information System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 CPU: (10) arm64 Apple M1 Max Memory: 32 GB Shell: /bin/zsh Package Manager Used: npm (10.2.4) Relevant Packages: @cloudflare/next-on-pages: 1.13.5 vercel: N/A next: 14.2.18 ### Description It just started happening out of the blue. Both when i try to build locally or when I git push and Cloudflare does the build for production. Even on Cloudflare pages if i try to re-deploy an old commit version that had previously deployed successfully, it also fails. Not sure exactly what the issue is... This is what i see in the terminal logs, and i see the error comes after the next build has completed: ``` [next js build stuff completes succesfully] ... ā² Build Completed in .vercel/output [33s] ā”ļø Completed `npx vercel build`. ā [ERROR] Could not resolve "async_hooks" <stdin>:596:680: 596 ā ...umerable:!0})),e);_(exports,{default:()=>N});var R=A(require("async_hooks")),S="@next/request-context",f=Symbol.for(S),C=Symbol.for("i... āµ ~~~~~~~~~~~~~ The package "async_hooks" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. /Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:1575 let error = new Error(`${text}${summary}`); ^ Error: Build failed with 1 error: <stdin>:596:680: ERROR: Could not resolve "async_hooks" at failureErrorWithLog (/Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:1575:15) at /Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:1033:28 at runOnEndCallbacks (/Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:1447:61) at buildResponseToResult (/Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:1031:7) at /Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:1143:14 at responseCallbacks.<computed> (/Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:680:9) at handleIncomingPacket (/Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:735:9) at Socket.readFromStdout (/Users/myuser/.npm/_npx/39e2fd552b408994/node_modules/esbuild/lib/main.js:656:7) at Socket.emit (node:events:519:28) at addChunk (node:internal/streams/readable:559:12) { errors: [ { detail: undefined, id: '', location: { column: 680, file: '<stdin>', length: 13, line: 596, lineText: ' const fn = (function(module,exports) {var b=Object.create;var p=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var h=e=>p(e,"__esModule",{value:!0});var _=(e,n)=>{h(e);for(var t in n)p(e,t,{get:n[t],enumerable:!0})},U=(e,n,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of T(n))!L.call(e,i)&&i!=="default"&&p(e,i,{get:()=>n[i],enumerable:!(t=w(n,i))||t.enumerable});return e},A=e=>U(h(p(e!=null?b(P(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);_(exports,{default:()=>N});var R=A(require("async_hooks")),S="@next/request-context",f=Symbol.for(S),C=Symbol.for("internal.storage");function O(){let e=globalThis;if(!e[f]){let n=new R.AsyncLocalStorage,t={get:()=>n.getStore(),[C]:n};e[f]=t}return e[f]}var q=O();function m(e,n){return q[C].run(e,n)}function y(e){let n={};return e&&e.forEach((t,i)=>{n[i]=t,i.toLowerCase()==="set-cookie"&&(n[i]=M(t))}),n}function M(e){let n=[],t=0,i,a,g,o,r;function x(){for(;t<e.length&&/\\s/.test(e.charAt(t));)t+=1;return t<e.length}function s(){return a=e.charAt(t),a!=="="&&a!==";"&&a!==","}for(;t<e.length;){for(i=t,r=!1;x();)if(a=e.charAt(t),a===","){for(g=t,t+=1,x(),o=t;t<e.length&&s();)t+=1;t<e.length&&e.charAt(t)==="="?(r=!0,t=o,n.push(e.substring(i,g)),i=t):t=g+1}else t+=1;(!r||t>=e.length)&&n.push(e.substring(i,e.length))}return n}function N(e){let n=e.staticRoutes.map(i=>({regexp:new RegExp(i.namedRegex),page:i.page})),t=e.dynamicRoutes?.map(i=>({regexp:new RegExp(i.namedRegex),page:i.page}))||[];return async function(a,g){let o=new URL(a.url).pathname,r={};if(e.nextConfig?.basePath&&o.startsWith(e.nextConfig.basePath)&&(o=o.replace(e.nextConfig.basePath,"")||"/"),e.nextConfig?.i18n)for(let s of e.nextConfig.i18n.locales){let u=new RegExp(`^/${s}($|/)`,"i");if(o.match(u)){o=o.replace(u,"/")||"/";break}}for(let s of n)if(s.regexp.exec(o)){r.name=s.page;break}if(!r.name){let s=E(o);for(let u of t||[]){if(s&&!E(u.page))continue;let d=u.regexp.exec(o);if(d){r={name:u.page,params:d.groups};break}}}let x=await m({waitUntil:g.waitUntil},()=>globalThis._ENTRIES[`middleware_${e.name}`].default.call({},{request:{url:a.url,method:a.method,headers:y(a.headers),ip:c(a.headers,l.Ip),geo:{city:c(a.headers,l.City,!0),country:c(a.headers,l.Country,!0),latitude:c(a.headers,l.Latitude),longitude:c(a.headers,l.Longitude),region:c(a.headers,l.Region,!0)},nextConfig:e.nextConfig,page:r,body:a.body}}));return x.waitUntil&&g.waitUntil(x.waitUntil),x.response}}function c(e,n,t=!1){let i=e.get(n)||void 0;return t&&i?decodeURIComponent(i):i}function E(e){return e==="/api"||e.startsWith("/api/")}var l;(function(o){o.City="x-vercel-ip-city",o.Country="x-vercel-ip-country",o.Ip="x-real-ip",o.Latitude="x-vercel-ip-latitude",o.Longitude="x-vercel-ip-longitude",o.Region="x-vercel-ip-country-region"})(l||(l={}));', namespace: '', suggestion: '' }, notes: [ { location: null, text: `The package "async_hooks" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.` } ], pluginName: '', text: 'Could not resolve "async_hooks"' } ], warnings: [] } Node.js v21.6.1 ``` ### 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? - [ ] Would you like to help fixing this bug?
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by jellohouse and has received 58 comments.