shopify-app-template-node icon indicating copy to clipboard operation
shopify-app-template-node copied to clipboard

Shopify node serve forcing us to use ngrok

Open redareda9 opened this issue 2 years ago • 4 comments

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

redareda9 avatar Aug 11 '21 04:08 redareda9

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).

maruffahmed avatar Aug 13 '21 10:08 maruffahmed

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

TheApeMachine avatar Dec 26 '21 17:12 TheApeMachine

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.

MaestroJurko avatar Mar 23 '22 23:03 MaestroJurko

@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.

TheApeMachine avatar Mar 24 '22 00:03 TheApeMachine

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.

github-actions[bot] avatar Oct 07 '22 02:10 github-actions[bot]

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.

knsakib avatar Oct 21 '22 05:10 knsakib

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.

mkevinosullivan avatar Jan 31 '23 19:01 mkevinosullivan