firebase / firebase/firebase-tools

Serve Dynamic Content with Express not deploys cloud function

Open
#6,878 2 comments 1 reaction 0 assignees View on GitHub
integration: web frameworks type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 13.5.0

**Platform:** macOS (M1)

### [REQUIRED] Test case

I want to deploy react app build with vite and express.js server for SSR. I've used next code template from [vite](https://github.com/bluwy/create-vite-extra/tree/master/template-ssr-react).
I've followed all mentioned steps described in [Serve Dynamic Content](https://firebase.google.com/docs/hosting/frameworks/express#serve_dynamic_content) and it's deploys static content but not cloud function (express server).

`server.js`
```
import express from 'express';

export function app() {
// Create http server
const app = express();
return app;
}
```

`firebase.json`
```
{
"hosting": {
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "europe-west1"
}
}
}
```

`package.json`
```
{
"name": "dyvoxyz",
"type": "module",
"directories": {
"serve": "dist/client"
},
"files": ["dist/client", "server.js"],
"main": "server.js",
```

### [REQUIRED] Steps to reproduce
1. Create project with react and vite, configure SSR using next code as [template](https://github.com/bluwy/create-vite-extra/tree/master/template-ssr-react)
2. `$ firebase experiments:enable webframeworks`
3. `$ firebase init hosting`
4. Add next attributes to `package.json`
```
"directories": {
"serve": "dist/client"
},
"files": ["dist", "server.js"],
"main": "server.js",
```
5. `$ firebase deploy`

### [REQUIRED] Expected behavior

Should deploy `server.js` as cloud function

### [REQUIRED] Actual behavior

Deploys only static files

image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.