Hey everyone! So Vercel got out of bed today and decided to screw me, no matter what i do it does not expose the created routes or swagger (BTW they work at dev env). And i need some help.
{
"version": 2,
"buildCommand": "npm run build",
"devCommand": "npm run start:dev",
"installCommand": "npm install --legacy-peer-deps",
"outputDirectory": "dist"
}
async function bootstrap() {
const app = await NestFactory.create(AppModule);
try {
app.enableCors({
origin: corsConfig.allowedDomains,
});
app.enableShutdownHooks();
app.setGlobalPrefix('server');
if (IS_DEV_ENV) {
const [{ SwaggerModule }, { swaggerConfig }, { writeFileSync }] =
await Promise.all([
import('@nestjs/swagger'),
import('./config/swagger.config'),
import('fs'),
]);
const document = SwaggerModule.createDocument(app, swaggerConfig);
writeFileSync('swagger-document.json', JSON.stringify(document, null, 2));
SwaggerModule.setup('server', app, document);
}
await app.listen(ENV_VARIABLES.PORT);
} catch (err) {
Logger.debug(JSON.stringify({ err }, null, 2));
process.exit(1);
}
}
bootstrap();
export const envSchema = z.object({
DATABASE_ROOT_PASSWORD: stringSchema,
DATABASE_DATABASE_NAME: stringSchema,
DB_PORT: optionalStringToIntegerSchema.default('5432'),
DATABASE_HOST: optionalStringSchema.default('localhost'),
DB_USER: stringSchema,
JWT_SECRET: stringSchema,
JWT_REFRESH_SECRET: stringSchema,
JWT_REFRESH_EXPIRES_IN: stringSchema,
JWT_ISSUER: optionalUrlStringSchema,
JWT_AUDIENCE: optionalUrlStringSchema,
JWT_EXPIRES_IN: stringSchema,
PORT: optionalStringToIntegerSchema.default('5000'),
ENV: z.enum(['prod', 'dev']).default('dev'),
});
All the env variables were applyed at vercel, scripts etc