nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Swagger trying to use hardcoded port instead .env PORT value

Open DreamShaded opened this issue 11 months ago • 0 comments

Environment

NodeJS: 20.11.0 NitroPack: latest (2.9.1)

Clean Nitro, without Nuxt

Reproduction

  1. Create dotenv file at root dir with PORT and/or NITRO_PORT not equal 3000, for example, 3001
  2. Set experimental.openApi as true at defineNitroConfig function
  3. Write some api, for me it was greeting function returning { hello: 'world' }
  4. Start dev server
  5. Check Nitro features working on custom port
  6. Go to /_nitro/swagger
  7. Try to execute some requests

Describe the bug

I want to see results for executed request using my custom port. I get the "failed to fetch" error, caused wrong request port.

image

Additional context

You can look at this on StackBlitz, wait for init and go to sb_url/_nitro/swagger

Logs

No response

DreamShaded avatar Mar 03 '24 23:03 DreamShaded