Skip to content
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

Update Vercel adapter to Node 14.8 to fix top level await builds #4782

Closed
digitaldeus opened this issue Apr 30, 2022 · 2 comments · Fixed by #4904
Closed

Update Vercel adapter to Node 14.8 to fix top level await builds #4782

digitaldeus opened this issue Apr 30, 2022 · 2 comments · Fixed by #4904
Labels
feature request New feature or request
Milestone

Comments

@digitaldeus
Copy link

digitaldeus commented Apr 30, 2022

Describe the bug

SvelteKit has been updated to node14.8 to enable top-level await per #4742 . Would be great if we could update the vercel adapter to the same version since it is currently forcing build version node14 and there doesn't appear to be a way to override it

Reproduction

repo here

to repro just run:

npm install
npm run build

Logs

> Using @sveltejs/adapter-vercel
✘ [ERROR] Top-level await is not available in the configured target environment ("node14")

    .svelte-kit/output/server/chunks/hooks-45a47dbd.js:1:0:
      1 │ await Promise.resolve(true);~~~~~

> Build failed with 1 error:
.svelte-kit/output/server/chunks/hooks-45a47dbd.js:1:0: ERROR: Top-level await is not available in the configured target environment ("node14")
.svelte-kit/output/server/chunks/hooks-45a47dbd.js:1:0: ERROR: Top-level await is not available in the configured target environment ("node14")
    at failureErrorWithLog (/Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:1603:15)
    at /Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:1249:28
    at runOnEndCallbacks (/Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:1162:65)
    at buildResponseToResult (/Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:1247:7)
    at /Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:1356:14
    at /Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:666:9
    at handleIncomingPacket (/Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:763:9)
    at Socket.readFromStdout (/Users/deusduke/src/vercel-top-level-await/node_modules/esbuild/lib/main.js:632:7)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:324:12)

System Info

System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 96.47 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.8.0 - /opt/homebrew/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 8.5.5 - /opt/homebrew/bin/npm
  Browsers:
    Brave Browser: 100.1.37.116
    Chrome: 100.0.4896.127
    Safari: 15.4

Severity

blocking all usage of SvelteKit

Additional Information

Unable to use sveltekit in vercel due to top level await issue

@antony
Copy link
Member

antony commented May 3, 2022

I might suggest that we instead read the node version from the application's config, rather than just update the hardcoded version inside the adapter.

@antony antony added the feature request New feature or request label May 3, 2022
@digitaldeus
Copy link
Author

Vercel now support Node16 so allowing the adapter to be dynamic would be a great approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants