yves404
11/13/2023, 2:04 AMexport const runtime = 'edge';
to the user route https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/api/user/route.ts
This now causes the error Module not found: Can't resolve 'zlib'
(same for querystring
and crypto
). e.g. when running in dev or even during build. Which i think is strange since the middleware uses withSession without issues an is supposed to be the same edge runtime.
The only "workaround" I found was to tell webpack to stop polyfilling (with config below). But that breaks things elsewhere. Have you (or someone else in here) had similar experiences or a better solution? Any recommendations going forward for Next.js Edge Functions?
const nextConfig = {
webpack(config) {
config.resolve.fallback = {
...config.resolve.fallback,
crypto: false,
querystring: false,
zlib: false,
};
return config;
},
}
rp_st
11/13/2023, 8:10 AMrp_st
11/13/2023, 8:10 AMrp_st
11/13/2023, 8:10 AMporcellus
11/13/2023, 8:14 AMporcellus
11/13/2023, 7:00 PMporcellus
11/13/2023, 7:04 PMruntime: "edge"
(I'll try and fix this later this week).
As an alternative you could use this method of session verification: https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/sessions/with-jwt/jwt-verification#method-1-using-jwks-endpoint-recommendedyves404
11/14/2023, 1:09 PMporcellus
11/17/2023, 11:14 AMporcellus
11/17/2023, 11:15 AM