firebase / firebase/firebase-tools

Deploy with `minInstances` throws an error for framework deployment

Open
#7,042 7 comments 2 reactions 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.7.1

**Platform:** Ubuntu

### [REQUIRED] Test case

Adding this configuration in `firebase.json` to you Firebase hosted Next.js project causes some inconveniences:
```
"frameworksBackend": {
"minInstances": 1
}
```
I think it adds, hidden from the developer, something like this to the deployment configuration (https://firebase.google.com/docs/hosting/full-config#rewrite-cloud-run-container) :
```
"hosting": {
// ...

// Directs all requests from the page `/helloworld` to trigger and run a `helloworld` container
"rewrites": [ {
"source": "/helloworld",
"run": {
"serviceId": "helloworld", // "service name" (from when you deployed the container image)
"pinTag": true
}
} ]
}

```
Related items: #6484 and #6684

### [REQUIRED] Steps to reproduce

1. Make a new Firebase hosting Next.js project, for example with `firebase init hosting`
2. Add the aforementioned `minInstances` setting to your hosting configuration.
3. Deploy

### [REQUIRED] Expected behavior

Successful deploys with no errors. Alternatively, a warning stating that pinTag was not set if that's what happens. Maybe remove `pinTag: true` from wherever it's set or allow setting `pinTag: false` in the frameworks configuration.

### [REQUIRED] Actual behavior

The deploy script prints the following error:

`Error: Function ssrhelloworld has minInstances set and is in a rewrite pinTags=true. These features are not currently compatible with each other.`.

However, when viewing the Function and associated Cloud Run, `minInstances` seem to be set and the deploy is successful. A tag is not associated with the revision. Here's a screenshot from the page of the associated Cloud Run:

Contributor guide

Open the contributing guide

Research direction

Start with the firebase.json frameworksBackend.minInstances setting and reproduce the deployment using firebase init hosting followed by deploy. Trace where the framework deployment creates the hosting rewrite and where the pinTags/minInstances incompatibility is reported. Done means a Next.js framework deployment completes without the error, or clearly warns when the settings cannot be combined.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.