Totomakers
11/03/2023, 1:22 PMres.setHeader is not a function
with NestJS + fastify;
Look like the function error come from Session.getSession
calling setCookie
with express framework instead of fastify.
import { Injectable } from '@nestjs/common';
import { HttpAdapterHost } from '@nestjs/core';
import { FastifyAdapter } from '@nestjs/platform-fastify';
import { plugin } from 'supertokens-node/framework/fastify';
@Injectable()
export class SupertokensFastify {
constructor(private readonly adapterHost: HttpAdapterHost) {
const httpAdapter = adapterHost.httpAdapter as FastifyAdapter;
if (!httpAdapter) return;
httpAdapter.getInstance().register(plugin);
}
}
I register the plugin like thisrp_st
11/03/2023, 1:32 PMTotomakers
11/03/2023, 1:34 PMEmailVerification.init({
mode: 'REQUIRED',
}),
Session.init(),
Dashboard.init(),
ThirdPartyEmailPassword.init({
});
Totomakers
11/03/2023, 1:34 PMTotomakers
11/03/2023, 1:34 PMrp_st
11/03/2023, 1:35 PMTotomakers
11/03/2023, 1:36 PMTotomakers
11/03/2023, 1:36 PMTotomakers
11/03/2023, 1:37 PMTotomakers
11/03/2023, 1:37 PMrp_st
11/03/2023, 1:39 PM