Consistent localhost port for proxied server?

I have been experimenting for about a week with Netlify Dev. I am using Parcel and netlify functions. Until had things running smoothly and consistently on port 8888, but something I did is now causing me to get a different port each time I run netlify dev -c "yarn start".

This is problematic because I need a consistent url for my OAuth callback. Any thoughts one what I’m doing wrong?

In the image below:

  1. Parcel is consistently port 1234
  2. Functions are consistently port 34567
  3. The netlify dev port is different each time
1 Like

The behavior is changing based on whether I pass the -c "yarn start" flag or not.

What I’ve worked out…
Not passing the -c "yarn start"

  • Netlify Dev isn’t catching that that I have a Parcel setup (not surprising as I have a sort of monorepo setup).
  • I need to start the Parcel server in a separate process
  • Netlify Dev properly hosts my parcel site with its “Simple Static Server” because I’ve configured the the publish folder, fontend/dist
  • I consistently get a proxy port of 8888 :sunny:

If do pass -c "yarn start"

  • Everything works awesome, EXCEPT I get a different proxied port with each run

Hi, @DroopyTersen. We do want to point out that currently Netlify Dev is beta software. And it is a publicly accessible repo here:

Please feel free to file issues for things you notice like this.

In the meantime, will the -p option documented here (link below) work for you?

Quoting:

USAGE
  $ netlify dev

OPTIONS
  -c, --command=command      command to run
  -f, --functions=functions  Specify a functions folder to serve
  -o, --offline              disables any features that require network access
  -p, --port=port            Specify port of netlify dev
  -l, --live                 Start a public live session

Please let us know if there are any questions or if this option doesn’t meet your requirement.

Have you tried configuring Dev via the [dev] section of netlify.toml?

The -p option has no effect for me. Neither does --port, or configuring the port in the .toml file.

hi, we have a response on a different, related thread:

https://answers.netlify.com/t/port-command-not-working/2321/3