zeferinix
06/06/2023, 11:59 AMsupertokens-node@13.4.1 to 14.1.1
- Docker Image supertokens-postgresql@4.6 to 5.0,
we're currently hitting a GET endpoint that's only available during development which just simply calls this code so that we get a session and move on
js
const session = await Session.createNewSession(ctx.req, ctx.res, user.id);
recipe code:
ts
import Session from 'supertokens-node/recipe/session/index.js';
import { UnauthenticatedError, UnauthorizedError } from '@/errors/index.js';
export const SessionRecipe = Session.init({
errorHandlers: {
onTokenTheftDetected: (sessionHandle, userId, req, res) => {
throw new UnauthorizedError('Token theft detected.', {
sessionHandle,
userId,
});
},
onUnauthorised: (_, req, res) => {
throw new UnauthenticatedError();
},
},
// https://supertokens.io/docs/session/advanced-customizations/apis-override/usage
override: {
apis: (originalImplementation) => ({
...originalImplementation,
// https://supertokens.io/docs/session/advanced-customizations/apis-override/disabling
signOutPOST: undefined,
}),
},
});
stacktrace is:
ts
Error: SuperTokens core threw an error for a POST request to path: '/recipe/session' with status code: 500 and message: Internal Error\n\n at Querier.<anonymous> (/usr/src/app/node_modules/.pnpm/supertokens-node@14.1.1/node_modules/supertokens-node/lib/build/querier.js:260:31)\n at Generator.throw (<anonymous>)\n at rejected (/usr/src/app/node_modules/.pnpm/supertokens-node@14.1.1/node_modules/supertokens-node/lib/build/querier.js:22:43)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n