-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Astro Info
Astro v5.13.9
Node v22.17.1
System macOS (arm64)
Package Manager pnpm
Output static
Adapter @astrojs/vercel
Integrations astro-auth
@astrojs/react
@astrojs/starlight
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Hiiiiiiii. Long time no see 👋
When trying to build with the Vercel adapter + auth-astro + edgeMiddleware: true, the following error occurs:
12:34:32 ├─ /reference/hooks/resize-observer/index.html (+2ms)
12:34:32 ├─ /reference/hooks/scrub/index.html (+3ms)
12:34:32 └─ /reference/hooks/shared-ref/index.html (+2ms)
12:34:32 ✓ Completed in 1.30s.
12:34:32 [build] Rearranging server assets...
12:34:32 [@astrojs/vercel] Bundling function ../../../../dist/server/entry.mjs
✘ [ERROR] Could not resolve "node:crypto"
dist/server/chunks/index_HCpzu1qN.mjs:1:19:
1 │ import crypto from 'node:crypto';
╵ ~~~~~~~~~~~~~
The package "node:crypto" 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.
✘ [ERROR] Could not resolve "node:process"
dist/server/chunks/Code_LWp2cPvZ.mjs:12:20:
12 │ import minproc from 'node:process';
╵ ~~~~~~~~~~~~~~
The package "node:process" 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.
✘ [ERROR] Could not resolve "node:path"
dist/server/chunks/Code_LWp2cPvZ.mjs:13:20:
13 │ import minpath from 'node:path';
╵ ~~~~~~~~~~~
The package "node:path" 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.
✘ [ERROR] Could not resolve "node:url"
dist/server/chunks/Code_LWp2cPvZ.mjs:14:30:
14 │ import { fileURLToPath } from 'node:url';
╵ ~~~~~~~~~~
The package "node:url" 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.
12:34:33 [ERROR] [@astrojs/vercel] An unhandled error occurred while running the "astro:build:done" hook
Could not resolve "node:process"
Location:
dist/server/chunks/Code_LWp2cPvZ.mjs:12:20
Stack trace:
at failureErrorWithLog (…/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1477:15)
at runOnEndCallbacks (…/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1317:45)
at …/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:971:16
at handleIncomingPacket (…/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:678:12)
at Socket.emit (node:events:518:28)
ELIFECYCLE Command failed with exit code 1.
So the node builtin is coming from something that is being used while building the middleware, but it’s tough to trace
What's the expected result?
I don’t have a simple reproduction that is able to recreate the issue, because I think it’s happening in SSR of a package importing a package importing a package. Vite tracing isn’t sure where the builtin is being imported from (I know it’s somewhere in the module graph, but it would take me some time to find out the source of the issue).
BUT I know the line of code that’s erring, and I do think it’s a bug. Will open up a PR and hopefully the issue is clear! 🙏
Link to Minimal Reproducible Example
N/A
Participation
- I am willing to submit a pull request for this issue.