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

Vercel Adapter doesn't bundle @libsql/client #9936

Closed
1 task done
binyamin opened this issue Feb 1, 2024 · 5 comments · Fixed by #9955
Closed
1 task done

Vercel Adapter doesn't bundle @libsql/client #9936

binyamin opened this issue Feb 1, 2024 · 5 comments · Fixed by #9955
Assignees
Labels
needs response Issue needs response from OP

Comments

@binyamin
Copy link

binyamin commented Feb 1, 2024

Astro Info

Astro                    v4.3.0
Node                     v20.9.0
System                   Linux (x64)
Package Manager          pnpm
Output                   server
Adapter                  @astrojs/vercel/serverless
Integrations             @astrojs/solid-js
which: no xclip in (./node_modules/.bin:/home/binyamin/.turso:/home/binyamin/.local/share/pnpm:/home/binyamin/.cargo/bin:/home/binyamin/.bun/bin:/home/binyamin/.deno/bin:/run/user/1000/fnm_multishells/3534986_1706800354736/bin:/home/binyamin/.local/share/fnm:/home/binyamin/.local/share/zinit/polaris/bin:/home/binyamin/.local/bin:/home/binyamin/bin:/home/binyamin/.local/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/home/binyamin/go/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/var/lib/snapd/snap/bin:/usr/local/go/bin)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When a project uses the @astrojs/vercel/serverless as an adapter, the module @libsql/client will never be bundled. This is hardcoded in src/lib/nft.ts. This behavior is not noted in the docs, and there's no warning from the CLI. The serverless function just fails.

The only hint to this is that the .vercel/output folder contains a broken symlink in the node_modules for @libsql/client.

What's the expected result?

The function should bundle appropriately. I can see from the code that it ignores @libsql/client for a reason. I don't understand the reason, but I am willing to brainstorm for a different solution.

Note: The reproduction on stackblitz will probably be useless, since stackblitz doesn't show the .vercel folder. See the source file instead.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-4vea6g

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 1, 2024
@matthewp matthewp self-assigned this Feb 1, 2024
@matthewp matthewp added the - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) label Feb 1, 2024
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Feb 1, 2024
@matthewp
Copy link
Contributor

matthewp commented Feb 1, 2024

Hey @binyamin, are you trying to use @libsql/client and it's not working for you? That ignore is just ignoring copying over of native dependencies that Vercel's file tracer thinks should be moved.

Node dependencies are not bundled by default, so this is normal behavior.

@matthewp matthewp removed the - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) label Feb 1, 2024
@binyamin
Copy link
Author

binyamin commented Feb 1, 2024

I did some digging. @libsql/client does support Vercel Edge functions, but through a subpath (@libsql/client/web). See https://github.com/tursodatabase/libsql-client-ts/?tab=readme-ov-file#importing. Astro won't even if I change it to the subpath.

@binyamin
Copy link
Author

binyamin commented Feb 1, 2024

Note that I am getting the same 500 error mentioned in #9801. Also, nft does write a file node_modules/@libsql/client. It's a broken symlink. So the import fails.

@matthewp
Copy link
Contributor

matthewp commented Feb 1, 2024

Astro doesn't support Vercel Edge functions for app deployment. Are you saying you have a project you're deploying to Serverless that's failing for this reason? That line you linked to that ignores @libsql/client is for an optimization.

They just released a wasm version of their library, @libsql/client-wasm but it's pretty experimental from what I understand.

@matthewp matthewp added the needs response Issue needs response from OP label Feb 1, 2024
@binyamin
Copy link
Author

binyamin commented Feb 2, 2024

See #9936 (comment)
I still don't get what's being optimized. libsql isn't just node dependencies. The root export will resolve to either a node- or web-compatible version, depending on the platform, using NPM export conditions.

What actually happens without the ignore?

Astro doesn't support Vercel Edge functions for app deployment. Are you saying you have a project you're deploying to Serverless that's failing for this reason?

FWIW, importing @libsql/client (root export) worked fine before v7.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs response Issue needs response from OP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants