firebase / firebase/apphosting-adapters
Custom ExpressJS integration not working
- Dominant language
- TypeScript
- Stars
- 478
- Forks
- 1.5k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 2
Description
Hey guys,
thanks for the effort of supporting web frameworks so far!
I'm trying to integrate the web framework support into [my SvelteKit adapter](https://www.npmjs.com/package/sveltekit-adapter-firebase), but I'm hitting a dead end.
My project looks like this:

`package.json`:
```
{
"name": "test-app",
"version": "0.0.1",
"type": "module",
"dependencies": {
"@neoconfetti/svelte": "^1.0.0",
"firebase": "^9.13.0",
"firebase-admin": "^11.0.4"
},
"main": ".firebase/functions/render.js",
"directories": {
"serve": "."
},
"files": [
"*",
"**/*"
],
"scripts": {
"build": "echo \"No build needed\""
}
}
```
`.firebase/functions/render.js`:
```
import { init } from './../function.js';
export const handle = init(...);
```
Where init(...) returns a express `(req,res) => void` handler function.
`firebase.json` which lies next to the `dist` folder pictured above:
```
{
"hosting": {
"source": "dist/apps/test-app",
"cleanUrls": true
}
}
```
I'm trying to preview the app with `emulators:start` but my function is not recognized i.e. not showing up in the console output.
I've debugged the `firebase-tools/frameworks` library a bit and it looks like the `getBootstrapScript` function in `firebase-tools/frameworks/express/index.js` is called with the project root (where my package.json lies) which can not be imported. I think it should probably try to import my `render.js` file, but I'm not sure how the framework support works internally.
Is there something wrong with my setup? Is the approach of prebuilding everything even feasible?
Thanks in advance
Contributor guide
Assessment
This issue has not been assessed yet.