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

Cannot work with hono + Cloudflareworkers #604

Closed
3 of 5 tasks
zouhangwithsweet opened this issue Feb 26, 2024 · 14 comments · Fixed by #670
Closed
3 of 5 tasks

Cannot work with hono + Cloudflareworkers #604

zouhangwithsweet opened this issue Feb 26, 2024 · 14 comments · Fixed by #670

Comments

@zouhangwithsweet
Copy link

Validations

Describe the bug

[wrangler:inf] GET / 500 Internal Server Error (27ms)
✘ [ERROR] TypeError: Cannot read properties of undefined (reading 'buffer')

      at createWasm
  (file:///Users/didi/Desktop/work/cofo-workers/node_modules/.pnpm/@shikijs+core@1.1.7/node_modules/@shikijs/core/dist/index.mjs:4629:47)
      at async main
  (file:///Users/didi/Desktop/work/cofo-workers/node_modules/.pnpm/@shikijs+core@1.1.7/node_modules/@shikijs/core/dist/index.mjs:4632:5)
      at async _load
  (file:///Users/didi/Desktop/work/cofo-workers/node_modules/.pnpm/@shikijs+core@1.1.7/node_modules/@shikijs/core/dist/index.mjs:4929:23)
      at async Array.<anonymous>
  (file:///Users/didi/Desktop/work/cofo-workers/packages/shiki/src/index.ts:10:3)
      at async jsonError
  (file:///Users/didi/Desktop/work/cofo-workers/node_modules/.pnpm/wrangler@3.29.0_@cloudflare+workers-types@4.20240222.0/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)

Reproduction

https://stackblitz.com/edit/stackblitz-starters-szxgur?file=src%2Findex.ts

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@zouhangwithsweet
Copy link
Author

@elliotberry
Copy link

I've been trying to do this too, and I'll also add that 7MB is a big yikes for cloudflare.

@zouhangwithsweet
Copy link
Author

I've been trying to do this too, and I'll also add that 7MB is a big yikes for cloudflare.

Does it work?

@elliotberry
Copy link

@zouhangwithsweet Hey! Yeah! Here's an example - https://github.com/elliotberry/shiki-with-just-nord-json-support. I used ESBuild to pull out just the parts I needed, and then used the bundle on workers. Let me know if you have any thoughts/questions

@zouhangwithsweet
Copy link
Author

@elliotberry Have you deployed your code on Cloudflare workers ?

@shellscape
Copy link

This is also impacting shellscape/jsx-email#82

@antfu
Copy link
Member

antfu commented Mar 13, 2024

CF does not support inline wasm, you need to import the .wasm file to get it work, as mentioned in https://shiki.style/guide/install#cloudflare-workers

@zouhangwithsweet
Copy link
Author

Is there a demo project?

@ghostdevv
Copy link

ghostdevv commented Apr 19, 2024

I've just tried on a fresh worker locally and it doesn't work, and am unable to push since it doesn't run - important to note that it doesn't have anything to do with hono

  Uncaught TypeError: Cannot read properties of undefined (reading 'buffer')
    at null.<anonymous>
  (file:///home/ghost/Desktop/ooglaslda/node_modules/.pnpm/@shikijs+core@1.3.0/node_modules/@shikijs/core/dist/index.mjs:4657:47)
  in u
   [code: 10021]

@orta

This comment was marked as resolved.

@shellscape

This comment was marked as resolved.

@elliotberry

This comment was marked as resolved.

@shellscape

This comment was marked as resolved.

@antfu

This comment was marked as resolved.

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

Successfully merging a pull request may close this issue.

6 participants