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

Switch from jose to cloudflare-worker-jwt #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Skaldebane
Copy link

I've had many issues with fireworkers with Cloudflare Pages (in a SvelteKit project).

At build time (on deployment), the build fails due to lack of CryptoKey, which is extremely weird.

image

However, I found a workaround inspired by panva/jose#411 (not included in this PR), by polyfilling CryptoKey from @peculiar/webcrypto before calling Fireworkers.init(...).

import { CryptoKey } from "@peculiar/webcrypto";
globalThis.CryptoKey = CryptoKey;

However, this fix only works when using @tsndr/cloudflare-worker-jwt, while jose complains about CryptoKey not being the same as the one it expects.

I'm currently using this version in a real app and it works flawlessly.

While jose should normally work just fine on any environment, cloudflare-worker-jwt is a pretty solid replacement, especially that fireworkers is targeting Cloudflare Workers specifically.

Maybe I'm missing something here, so it's okay if you refuse this change!

@alexiglesias93
Copy link
Member

I just updated the jose dependency version from 4.11.2 to 5.9.6 in #42. Can you let me know if after this upgrade the issue still persists? If yes, I'll merge this PR.

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 this pull request may close these issues.

2 participants