First request Always Fails
Hi. I'm trying to use serverless-http with NestJS. I'm seeing a strange issue where serverless basically processes the first request before the app has bootstrapped, causing the first request to always return a 404. Subsequent requests work.
Here's my handler function:
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
import { ExpressAdapter } from '@nestjs/platform-express';
import * as serverless from 'serverless-http';
import * as express from 'express';
const server = express();
export const createNestServer = async expressInstance => {
const app = await NestFactory.create(AppModule, new ExpressAdapter(expressInstance));
app.enableCors();
return app.init();
};
createNestServer(server)
.then(v => console.log('Nest Ready'))
.catch(err => console.error('Nest broken', err));
export const handler = serverless(server);
Watching Doesn't Seem to Work
Another issue I'm seeing is that even though I see this in the console every time I make a change to the source files:
74 modules
Serverless: Watching for changes...
the app doesn't actually re-build, meaning the changes are not reflected.
First request Always Fails Hi. I'm trying to use serverless-http with NestJS. I'm seeing a strange issue where serverless basically processes the first request before the app has bootstrapped, causing the first request to always return a 404. Subsequent requests work.
Here's my handler function:
Watching Doesn't Seem to Work Another issue I'm seeing is that even though I see this in the console every time I make a change to the source files:
the app doesn't actually re-build, meaning the changes are not reflected.
Any idea why these two things may be happening?