supertokens-node
supertokens-node copied to clipboard
Create a serverless.com framework integration
- [ ] Able to add auth endpoint automatically
- [ ] Able to do CORS and gateway config automatically
- [ ] No need to create explicit express app in user's API endpoints for session management.
See https://medium.com/swlh/how-to-actually-develop-test-and-publish-your-first-plugin-for-the-serverless-framework-337665eb66fa
Hi!
I want to share my experience in making this library work inside a Cloudflare Worker.
- Add
node_compat = trueto the wrangler.toml config file. - Commented out
assertThatBodyParserHasBeenUsedForExpressLikeRequestfromlib/build/framework/utils.jsas the file importshttppackage from node which is not supported by Worker - I've removed all
import { URL } from "url"statements as URL class is native to Worker - I've added the
@vespaiach/axios-fetch-adapterpackage andadapter: fetchAdapterto all axios requests - Created a
WorkerRequestandWorkerResponsewrappers to pass tosupertokens.middleware(...)
I'm currently stuck at this point...
WARNING: known issue with `fetch()` requests to custom HTTPS ports in published Workers:
- https://<REDACTED>.aws.supertokens.io:3573/apiversion - the custom port will be ignored when the
Worker is published using the `wrangler publish` command.