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

Bug: Sveltekit for Cloudflare not supported #30

Open
4 tasks done
gerhardcit opened this issue May 1, 2024 · 3 comments
Open
4 tasks done

Bug: Sveltekit for Cloudflare not supported #30

gerhardcit opened this issue May 1, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@gerhardcit
Copy link

gerhardcit commented May 1, 2024

Prerequisites

Describe the issue

Using Kinde in sveltekit for deployment on cloudflare, npm dev works perfectly.
But when you want to build the app for deployment to cloudflare, you get this.

> Using @sveltejs/adapter-cloudflare
✘ [ERROR] Could not resolve "node:http"

    .svelte-kit/output/server/chunks/KindeSDK.js:8:22:
      8 │ import * as http from "node:http";~~~~~~~~~~~

  Cannot use "node:http" when deploying to Cloudflare.


✘ [ERROR] Could not resolve "node:https"

    .svelte-kit/output/server/chunks/KindeSDK.js:9:23:
      9 │ import * as https from "node:https";~~~~~~~~~~~~

  Cannot use "node:https" when deploying to Cloudflare.

Is Kinde Auth for Sveltekit design to work with Cloudflare Adapter?

Library URL

https://kinde.com/docs/developer-tools/sveltekit-sdk/

Library version

1.3.0

Operating system(s)

macOS

Operating system version(s)

Sanoma 14.3.1

Further environment details

See Cloudflare limits

@gerhardcit gerhardcit added the bug Something isn't working label May 1, 2024
@calebltan
Copy link

Did you end up finding a solution for this @gerhardcit?
I also wanted to use the SDK on Cloudflare pages but couldn't due to the same issues.

I ended up reverting to using the non-SDK version of Kinde in Sveltekit.
https://docs.kinde.com/developer-tools/about/using-kinde-without-an-sdk/

@gerhardcit
Copy link
Author

Did you end up finding a solution for this @gerhardcit? I also wanted to use the SDK on Cloudflare pages but couldn't due to the same issues.

I ended up reverting to using the non-SDK version of Kinde in Sveltekit. https://docs.kinde.com/developer-tools/about/using-kinde-without-an-sdk/

Unfortunately not, so I ended up using authjs which worked fine for me. I'm surprised no one at Kinde has made any effort to support this. Cloudflare workers is quite widespread from what I can see.

@colinbate
Copy link

@calebltan I started using the SDK on Cloudflare Pages late September and it seemed to work fine, at least for the basics. That was version 1.3.0. It is possible a transitive dependency updated since you tried it.

I recently updated to the 2.1.0 version and found that broke Cloudflare a bit because of use of process. I've opened an issue for that, but it can be worked around with compatibility_flags = ["nodejs_compat"] in your wrangler.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants