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 work with <Code /> component #6174

Closed
1 task
Ehesp opened this issue Feb 8, 2023 · 11 comments · Fixed by #6198
Closed
1 task

Vercel adapter doesn't work with <Code /> component #6174

Ehesp opened this issue Feb 8, 2023 · 11 comments · Fixed by #6198
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@Ehesp
Copy link

Ehesp commented Feb 8, 2023

What version of astro are you using?

2.0.8

Are you using an SSR adapter? If so, which one?

Vercel (^3.0.1)

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

When including the <Code /> component in pages, the shiki themes are not being uploaded to Vercel:

[ssr] Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/themes/css-variables.json' (x13)
<Code
  theme="css-variables"
  lang="js"
  code="console.log('Hello, world!');"
/>

See repro link for an example. This works in dev, but fails when deployed to Vercel.

Link to Minimal Reproducible Example

https://github.com/Ehesp/astro-vercel-shiki-error

Participation

  • I am willing to submit a pull request for this issue.
@matthewp
Copy link
Contributor

matthewp commented Feb 8, 2023

Thanks! It looks like this is due to the fact that shiki dynamically loads json files. I feel like we have solved this issue in the past, let me do some research and see what changed here.

@matthewp matthewp added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Feb 8, 2023
@matthewp
Copy link
Contributor

matthewp commented Feb 8, 2023

Ah yes, we did previously fix this here: #5409

@matthewp
Copy link
Contributor

matthewp commented Feb 8, 2023

@Ehesp the reproduction doesn't seem to use Code, or vercel. Can you update it?

@Ehesp
Copy link
Author

Ehesp commented Feb 8, 2023

Oh woops I pushed the empty repo. Updated now

@matthewp matthewp self-assigned this Feb 8, 2023
@matthewp
Copy link
Contributor

matthewp commented Feb 9, 2023

Just dropping in to say I can recreate the error. Digging into why our solution isn't working any more.

@matthewp
Copy link
Contributor

matthewp commented Feb 9, 2023

Pretty sure it's caused by this change: #5952

Working on a fix.

@matthewp
Copy link
Contributor

matthewp commented Feb 9, 2023

Should be fixed by #6198 Going to deploy a test app to confirm.

@matthewp
Copy link
Contributor

matthewp commented Feb 9, 2023

@matthewp
Copy link
Contributor

matthewp commented Feb 9, 2023

Being released now, thanks again for bringing this important issue to our attention @Ehesp

https://github.com/withastro/astro/actions/runs/4137734219/jobs/7153272973

@Ehesp
Copy link
Author

Ehesp commented Feb 9, 2023

@matthewp thanks, although I've just upgraded both astro and @astro/vercel, and I get another error now:

2023-02-09T20:54:34.138Z	2824ee7c-5fe2-449a-9519-afc400a7e0cf	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'","reason":{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'","code":"ENOENT","errno":-2,"syscall":"open","path":"/var/task/node_modules/shiki/languages/html.tmLanguage.json","stack":["Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'","    at process.<anonymous> (file:///var/runtime/index.mjs:1194:17)","    at process.emit (node:events:539:35)","    at emit (node:internal/process/promises:140:20)","    at processPromiseRejections (node:internal/process/promises:274:27)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
Unknown application error occurred
Runtime.Unknown

It's a bit late here though so I'll properly check it out in the morning.

@kayn1
Copy link

kayn1 commented Apr 9, 2023

I have got the same error today when using Code with Vercel.

@matthewp thanks, although I've just upgraded both astro and @astro/vercel, and I get another error now:

2023-02-09T20:54:34.138Z	2824ee7c-5fe2-449a-9519-afc400a7e0cf	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'","reason":{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'","code":"ENOENT","errno":-2,"syscall":"open","path":"/var/task/node_modules/shiki/languages/html.tmLanguage.json","stack":["Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: ENOENT: no such file or directory, open '/var/task/node_modules/shiki/languages/html.tmLanguage.json'","    at process.<anonymous> (file:///var/runtime/index.mjs:1194:17)","    at process.emit (node:events:539:35)","    at emit (node:internal/process/promises:140:20)","    at processPromiseRejections (node:internal/process/promises:274:27)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
Unknown application error occurred
Runtime.Unknown

It's a bit late here though so I'll properly check it out in the morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants