App reviews, troubleshooting, and recommendations
I am in the process of converting an old project from CLIv2 to the new CLIv3 structure.
My issue: CLI v3 seems to always randomly update the process.env.PORT to a 5xxxx number,
and then configures the ngrok tunnel through this port.
I've tried forcing the port number to 3000 by changing the 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.
My question: how do I configure a my CLI v3 project to force a specific port (3000) to be passed in as process.env.PORT within the CLI 'shopify app dev' script? .
I've had no luck passing variables in through a .env file.
If anybody can point me to a working example, I would greatly appreciate it!
Solved! Go to the solution
This is an accepted solution.
Hello @tomadelaney,
This is AJ from StoreWatchers.
You can set port in shopify.web.toml
configuration file. Please find more detail on Shopify official page https://shopify.dev/docs/apps/tools/cli/migrate#web-component-conventions
Thanks
This is an accepted solution.
Hello @tomadelaney,
This is AJ from StoreWatchers.
You can set port in shopify.web.toml
configuration file. Please find more detail on Shopify official page https://shopify.dev/docs/apps/tools/cli/migrate#web-component-conventions
Thanks
AJ,Thank you for your reply.I’ve tried to work through the CLI migration guide in the past, with many permutations of PORT, SERVER_PORT and BACKEND_PORT in the shopify.web.toml files. The CLI seems to still randomly insert its own port.I will work through the migration guide again, and document my solution in this thread if I succeed.Thanks again for your reply.Tom
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024