Hi, I'm trying to add frontend api in Next 12: I'm...
# general
w
Hi, I'm trying to add frontend api in Next 12: I'm doing like in: https://supertokens.com/docs/thirdpartyemailpassword/nextjs/init but I have: > [PWA] Build in develop mode, cache and precache are mostly disabled. This means offline support is disabled, but you can continue developing other functions in service worker. wait - compiling /_error (client and server)... error - ../../node_modules/supertokens-auth-react/lib/build/authRecipe-shared.js:4:0 Module not found: Can't resolve 'react/jsx-runtime' Import trace for requested module: ../../node_modules/supertokens-auth-react/lib/build/thirdpartyemailpassword.js ../../node_modules/supertokens-auth-react/recipe/thirdpartyemailpassword/index.js ./config/superTokens.tsx ./pages/_app.tsx https://nextjs.org/docs/messages/module-not-found I use next-pwa and when I moved if (typeof window !== 'undefined') { SuperTokensReact.init(frontendConfig()) } to next.config.js /** @type {import("next").NextConfig} */ const withPWA = require('next-pwa'); module.exports = withPWA({ reactStrictMode: true, i18n: { locales: ['en', 'jp', 'pl'], defaultLocale: 'en', }, images: { deviceSizes: [280, 320, 375, 425, 768, 1024, 1200, 1440, 2560], loader: 'default', domains: ['s.yimg.com', 'localhost', 'pfartists.xyz'], formats: ['image/avif', 'image/webp'], }, pwa: { dest: 'public', register: true, skipWaiting: true, }, }); What is reason? 🤔
r
Seems like a react module was not found. Have you installed dependencies correctly?
w
Yes, I copied from your documentions in nextjs section
r
Have you setup the NextJS app correctly?
Also, you need to run yarn add supertokens-web-js as well
w
both yes
r
Maybe @porcellus can help out
w
ok :)
@rp_st aa and I forgot: To verify session in next (frontend) when I have backend in nestjs, I need to use: https://supertokens.com/docs/thirdpartyemailpassword/nextjs/session-verification/in-ssr , yes?
r
Yes
w
only I need change backendConfig to frontendConfig?
r
Please see the guide. Thanks
w
Ok. I were making sure.
p
hi
are you using react in next?
umm, I mean, do you have react installed? which version?
w
I use Nextjs 12 so React too.
hmm
React: 17.0.2
Nextjs: 12.1.4
@porcellus ? :)
p
can you try re-installing your dependencies? are you using pnpm or yarn link in your setup?
w
ok
the same error :/
error - ../../node_modules/supertokens-auth-react/lib/build/authRecipe-shared.js:4:0 Module not found: Can't resolve 'react/jsx-runtime' Import trace for requested module: ../../node_modules/supertokens-auth-react/lib/build/thirdpartyemailpassword.js ../../node_modules/supertokens-auth-react/recipe/thirdpartyemailpassword/index.js ./config/superTokens.tsx ./pages/_app.tsx https://nextjs.org/docs/messages/module-not-found
p
are you using pnpm or yarn link in your setup? or just plain npm?
w
yarn
p
also, did you clear the lockfiles and node_modules before re-installing?
w
Do you mean what did I delete yarn.lock?
p
yeah.
w
no
I try again with this
p
also, does your app run without supertokens-auth-react?
w
dependences are installed and don't help
? I'm doing as in documentation. I don't add sign in and sign up.
I only did installation.
p
so you are not importing anything in the app?
w
yes
p
I mean the import trace you pasted here shows that you do.
anyway, I have to leave now for a bit, I'll investigate this after I get back. also, I'm not sure this issue is related to supertokens, please confirm that the app works right/loads if you are not adding our SDK
w
Vs code is stupid xd this module wasn't installed but for the first time, it did not show me an error when importing.xd
but
I have now:
xd
Maybe I need config to next.config.js
This is the only thing I can think of right now. And frontend was working earlier. I'm changing from Firebase to SuperTokens.
p
to be honest I'm not sure what causes this error besides what it says in the error message.
I'm fairly sure that this doesn't have anything to do with supertokens though.
r
Thanks for your help @porcellus. This error doesn’t seem to be from supertokens.
@weboux please try and figure this out on your own.
w
I guess I have to use like for React and not Nexta 🤔 maybe then it will go. Just a shame because it won't use nexta's backend functions and I wanted to learn that xd probably won't work out If not, and vs code error, and probably wasn't this talking :/
2 Views