I have set up a function in Redwood that opens a Playwright Chromium browser. However, it seems like after changes in the code the API server fails to reload in dev environment.
apI/src/functions/foo.ts
import { chromium } from 'playwright'
export const handler = async () => {
const browser = await chromium.launch({ headless: true })
await browser.close()
return { body: 'Saaan' }
}
Reproduction
- Load the function http://localhost:8911/foo
- Edit a file in the project. It can be any file, for example, foo.ts
- Load the function again http://localhost:8911/foo
- The api log now shows “Error: listen EADDRINUSE: address already in use :::8911” and the changes haven’t been applied.
Is there something I’m missing here? I have double-checked so the headless browser is closed and I’m using the latest version of Redwood and Playwright. Would appreciate some assistance before filing a ticket in case I’m missing something.