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
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024