firebase / firebase/firebase-tools
Emulator not working with multiple express servers on multiple http triggers across different codebases with --inspect-functions
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
### [REQUIRED] Environment info
**firebase-tools:** 13.29.1
**Platform:** macOS
### [REQUIRED] Test case
have 2 of these (across 2 codebases, with different names for each (i have api and worker))
```
import { environment } from '@ai-music-video-studio/worker-config';
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import express from 'express';
import * as admin from 'firebase-admin';
import { onRequest } from 'firebase-functions/https';
import { AppModule } from './app/app.module';
admin.initializeApp();
if (environment.currentEnvironment === 'development') {
console.log('Using firestore emulator.');
process.env.FIRESTORE_EMULATOR_HOST = 'localhost:8080';
}
const server = express();
const createNestServer = async (expressInstance: express.Express) => {
console.log('Creating Worker Nest Server');
const app = await NestFactory.create(
AppModule,
new ExpressAdapter(expressInstance),
);
await app.init();
};
// createNestServer(server)
// .then(() => Logger.log('Nest listening'))
// .catch((err) => Logger.error('Nest Error', err));
// export const worker = onRequest(
// { timeoutSeconds: 3600, memory: '8GiB' },
// server,
// );
export const worker = onRequest(
{ timeoutSeconds: 3600, memory: '8GiB' },
async (req, res) => {
await createNestServer(server);
server(req, res);
},
);
```
### [REQUIRED] Steps to reproduce
run with --inspect-functions (also using firestore emulator with import and export data, but this isnth relevant)
(my command is this
`firebase emulators:start --only functions,firestore --project staging --import=./emulator-export-data --export-on-exit=./emulator-export-data
`)
### [REQUIRED] Expected behavior
functions to work with debugger
### [REQUIRED] Actual behavior
doesn't work at all, seems to get stuck or something and stops responding to requests. one of the http servers sometimes works with debugging, but the other one doesnt work at all (the first one sends a request to the second one over http)
it works just fine without inspect-functions, i assume its coz it allows for parallel execution which is related to allowing multiple express instances across codebases for multiple http triggered functions)
(also side-note, watching and refreshing on changes doestn seem to be working under this scenario too, I have to use nodemon)
Contributor guide
Assessment
This issue has not been assessed yet.