Can't Specify Server Port With CLI V3

tomadelaney
Shopify Partner
10 2 2

Migrating my existing app from CLIv2 to CLIv3.

Issue:

CLI always overwrites my desired server Port 3000 with a random port in the 5xxxx range at runtime.

Attempted Solutions:

A)  Tried adding PORT=3000 to .env

B) Tried adding PORT=3000 to the shopify.web.toml files

C) Tried forcing the port number to 3000 by changing the backend dev script

from:

"dev": "NODE_ENV=development nodemon --exec babel-node server/index.js --watch server/" 

to:

"dev": "cross-env PORT=3000 nodemon --exec babel-node server/index.js --watch server/",

... but in this case, the tunnel is created at 3000, but the CLI tries to open a second ngrok tunnel, resulting in a 'you are only allowed one tunnel" error.

D)  Tried to preset an NGROK Tunnel and use --tunnel-url flag in the CLI dev script:

sudo npm run dev -- --reset --tunnel-url https://7ea4-100-37-157-53.ngrok.io:3000

... resulting in the flag being ignored -- the port is overwritten to 5xxxx

E) Repeated (D) with a Cloudflare Tunnel

... resulting in the flag being ignored -- the port is overwritten to 5xxxx

 

In all cases, the process.env.port is rewritten to a 5xxxx port.

Any thoughts or guidance would be appreciated.

Regards,

Tom

Replies 0 (0)