shopify-app-template-node
shopify-app-template-node copied to clipboard
Shopify node serve forcing us to use ngrok
Issue summary
Shopify node serve command forces the developer to use ngrok. It's not possible to disable ngrok. I'm based in Vietnam and ngrok takes around 20 seconds to respond so I prefer using localtunnel.
Expected behavior
It should be possible to disable ngrok, stop automatically updating .env file with ngrok URL.
Actual behavior
The command opens a ngrok tunnel then updates .env automatically.
Steps to reproduce the problem
Run shopify node serve
Specifications
- Browser: Chrome
- Device: Macbook Pro
- Operating System: Mojave
This is an issue until I have found my way to solve this. Here how:
Use the npm run dev
or yarn run dev
command. It'll run your app in development environment. On another terminal, you can run your localtunnel
. If you use this approach, you have to update the tunnel URL manually (.env and partner app setup).
If you want this automated again, and know enough Ruby, clone the CLI and change in the following files anything you need to change: https://github.com/Shopify/shopify-cli/search?q=ngrok
What is the URL that you open up then?
An example of what I open up now with the browser is https://subdomain.domain.com/auth?shop=myshop.myshopify.com but it is not working, authentication fails.
@puppeteer701 Did you set the redirect urls and stuff? Otherwise have a look in the network tab of development tools in the browser, it should give an idea.
Though honestly, if this is something you work on a lot, why not just forward a port from your router to your development machine and get some free domain. An added benefit is that it is much faster than reverse tunnelling. Or...
./app/Dockerfile
FROM node:16
WORKDIR /app
COPY . .
COPY .env.prod .env
RUN npm install && npm run build
EXPOSE 8081
CMD npm start
./tunnel/Dockerfile
FROM mhart/alpine-node
MAINTAINER Emmanuel Frecon <[email protected]>
RUN npm install -g localtunnel
ENTRYPOINT ["node", "/usr/bin/"]
./docker-compose.yml
version: '3'
services:
app:
build:
context: ./app
lt:
build:
context: ./tunnel
command: "lt --port 8081 --local-host app"
depends_on:
- app
Which I totally did not test, but something like that gives you a relatively ok setup. Package up the shopify-cli tool as well in a container with a Ruby base, and you can even still use some of the tooling in that.
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.
OMG! is Shopify owned by ngrok? Every app demo, even shopify serve command forced to use ngrok! And on top of that, what a nasty service, slow and pricy this thing is!
Solve the issue first and then close this ticket. Do not force us to use ngrok. I simply want to start localhost. I will figure out tunnelling stuff myself.
Here are some instructions in the readme on how to use (in this case) Cloudflare Tunnel with Shopify CLI v3, bypassing the ngrok command used by the CLI itself.
Other tunnel software options can be used too. Once, the tunnel is established, pass the tunnel details using the --tunnel-url
option to the CLI.