firebase / firebase/firebase-tools

Functions emulator does not support concurrency and maxInstances options

Open
#5,503 3 comments 0 reactions 1 assignee Claimed by @taeold View on GitHub
emulators: functions type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 11.22.0

**Platform:** Windows 10

### [REQUIRED] Test case

**functions/src/index.ts**
```
const browserPromise = puppeteer.launch({
headless: false
})

export const example = onRequest(
{
cors: true,
concurrency: 100,
timeoutSeconds: 10,
minInstances: 1,
maxInstances: 1
},
async (req, res) => {
const browser = await browserPromise

const page = await browser.newPage()
page.goto('https://www.google.com')

await new Promise((resolve) => {
setTimeout(resolve, 5000)
})
const pages = await browser.pages()
if (pages.length > 1) {
await page.close()
}

res.sendStatus(200)
}
)
```

**client-side**
```
setInterval(() => {
fetch('http://127.0.0.1:5001/project-name/us-central1/example')
}, 3000)
```

### [REQUIRED] Steps to reproduce

Install Puppeteer
Include the `example` function above in your functions/src/index.ts
Run the client-side script

### [REQUIRED] Expected behavior

Tabs open and close in **one** Puppeteer browser

### [REQUIRED] Actual behavior
Tabs open and close in **multiple** Puppeteer browsers

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.