nickm91.
08/30/2022, 6:01 AMimport { Logger } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import { init } from "supertokens-node";
import { middleware } from "supertokens-node/lib/build/framework/express";
import Session from "supertokens-node/recipe/session";
import { AppModule } from "./app/app.module";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const port = process.env.PORT || 3000;
await app.listen(port);
app.use(middleware());
init({
framework: "express",
appInfo: {
appName: "codestacks",
apiDomain: "http://localhost:3000",
websiteDomain: "http://localhost:4200",
},
supertokens: {
connectionURI: "http://localhost:3567",
},
recipeList: [Session.init()],
});
Logger.log(`🚀 Application is running on: http://localhost:${port}`);
}
bootstrap();
The expectation is now that http://localhost:3000/auth/signup
etc.. will now be created. However when using postman or curl to POST the routes are 404. Similarly, if you point the supertokens FE at this api domain it is similarly returning 404 in the network request coming from the supertokens UI.
FYI same thing happens if I follow the actual nest setup with in the guide with an AuthModule - however I suspect that should not make a difference to the minimal repro code above, its just "nestifying" the middleware, it should work the same in both scenarios AFAIK.rp_st
08/30/2022, 6:23 AMrp_st
08/30/2022, 6:23 AMrp_st
08/30/2022, 6:23 AMrp_st
08/30/2022, 6:24 AMnickm91.
08/30/2022, 6:27 AMimport { Logger } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import supertokens, { init } from "supertokens-node";
import { middleware } from "supertokens-node/framework/express";
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import { AppModule } from "./app/app.module";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const port = process.env.PORT || 3000;
await app.listen(port);
app.use(middleware());
init({
framework: "express",
appInfo: {
appName: "app",
apiDomain: "http://localhost:3000",
websiteDomain: "http://localhost:4200",
apiBasePath: "/auth",
websiteBasePath: "/auth",
},
supertokens: {
connectionURI: "http://localhost:3567",
},
recipeList: [Session.init(), EmailPassword.init()],
});
app.enableCors({
origin: "http://localhost:4200",
allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
credentials: true,
});
Logger.log(`🚀 Application is running on: http://localhost:${port}`);
}
bootstrap();
nickm91.
08/30/2022, 6:27 AMrp_st
08/30/2022, 6:28 AMrp_st
08/30/2022, 6:28 AMnickm91.
08/30/2022, 6:34 AMrp_st
08/30/2022, 6:38 AMrp_st
08/30/2022, 6:39 AMapp.use(middleware());
is not correctly donerp_st
08/30/2022, 6:39 AMnickm91.
08/30/2022, 9:04 AMnickm91.
08/30/2022, 9:05 AMError: No SuperTokens core available to query
nickm91.
08/30/2022, 9:10 AMnickm91.
08/30/2022, 9:10 AMnickm91.
08/30/2022, 9:18 AMhttp://auth:3567
works as per docker compose network discoverabilityrp_st
08/30/2022, 9:51 AM