I encountered a TypeError when attempting to reset a user's password in a Next.js application using SuperTokens. The error occurs when the user clicks "Change Password" after entering the new password and confirming it.
Steps to Reproduce:
Create a new next.js application: npx create-supertokens-app@latest, Next.js -> App Directorty -> Social Login + Email Password
Run it locally
Create an account using email + password
Sign out
Reset password with the associated email
Open reset password link from the email received
Proceed to input new and confirm passwords
Click "Change password"
Observe the UI with an error "Something went wrong. Please try again."
Observe the terminal logged with TypeError Body is unusable...
Error sample:
TypeError: Body is unusable
at specConsumeBody (node:internal/deps/undici/undici:6630:15)
at NextRequest.json (node:internal/deps/undici/undici:6533:18)
at Object.getJSONBody (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/nextjs.js:71:38)
at PreParsedRequest.getJSONBody (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/framework/custom/framework.js:45:33)
at Object.passwordReset [as default] (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/recipe/emailpassword/api/passwordReset.js:36:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Recipe.handleAPIRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/recipe/emailpassword/recipe.js:95:24)
at async Recipe.handleAPIRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/recipe/thirdpartyemailpassword/recipe.js:49:24)
at async SuperTokens.middleware (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/supertokens.js:160:38)
at async eval (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/framework/custom/framework.js:134:28)
at async handleCall (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/nextjs.js:76:40)
at async /Users/path-to-project/node_modules/.pnpm/next@14.0.3_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:62609```
Brief
I encountered a TypeError when attempting to reset a user's password in a Next.js application using SuperTokens. The error occurs when the user clicks "Change Password" after entering the new password and confirming it.
Steps to Reproduce:
npx create-supertokens-app@latest
, Next.js -> App Directorty -> Social Login + Email PasswordTypeError Body is unusable...
Error sample: