Closed shreyas707 closed 1 year ago
Weirdest part is this project worked perfectly well 2 weeks ago. Now I open it and it suddenly doesn't.
Things I've tried:
-- --tunnel-url
optionnpm run shopify auth logout && npm run dev -- --reset
localhost:<port>
on my browser, but not with ngrok/cloudflare tunnel urlNot sure what else I can do here.
Note: I've changed the API key in the verbose output for obvious reasons
I have a similar issue. Everything was fine a few days ago, ran npm run dev
today and get the ECONNREFUSED
error. I also tried logging out and resetting. I then tried deleting the app from the dev store and my partners account, and creating a new app from scratch. After doing all that, I am now getting a 401 error when I try to run the app.
Looking at the log it seems to me that the frontend
process is only being exposed in localhost
, but not on the other network interfaces. Your output looks like this:
2023-04-25 12:04:07 │ frontend │ > Local: http://localhost:59388/
2023-04-25 12:04:07 │ frontend │ > Network: use `--host` to expose
While mine looks like this:
2023-04-25 15:44:14 │ frontend │ > Local: http://localhost:54388/
2023-04-25 15:44:14 │ frontend │ > Network: http://127.0.2.2:54388/
2023-04-25 15:44:14 │ frontend │ > Network: http://127.0.2.3:54388/
2023-04-25 15:44:14 │ frontend │ > Network: http://192.168.1.243:54388/
2023-04-25 15:44:14 │ frontend │ > Network: http://172.16.0.2:54388/
What happens if you change web/frontend/shopify.web.toml
to be like this?
type="frontend"
[commands]
dev = "npm run dev -- --host"
build = "npm run build"
@Arkham This works, thank you so much!
Will there be a fix in the future versions or is something wrong with my setup? What I don't understand is how/why did it stop working all of a sudden when I made no changes locally?
@Arkham In my case web/frontend/shopify.web.toml
already has that. There appears to be an issue with the session though. I can see an error coming from node_modules/@shopify/shopify-api/lib/clients/graphql/graphql_client.js:14
if (!config.isCustomStoreApp && !params.session.accessToken) {
2023-04-25 17:52:22 │ backend │ ^
2023-04-25 17:52:22 │ backend │
2023-04-25 17:52:22 │ backend │ TypeError: Cannot read properties of undefined (reading 'accessToken')
I tried npm run dev -- --reset
and also npm run shopify app env pull
, and tried using a different store / creating a whole new app but the issue persists. I also tried deleting all rows in the sqlite sessions table and changing the session storage to use sessionStorage: new MemorySessionStorage(),
, but nothing seems to fix it.
How can I fix or reset the session so the accessToken is available?
UPDATE:
I checked out a previous commit, ran npm run dev
and did NOT encounter the error. I then checked out HEAD and tried again (no code changes from when I was getting the error before) and did not encounter the error. I spent quite a long time trying to debug and would love to know what happened and how to avoid it in the future! @Arkham if you have any insight, it would be appreciated!
@Arkham same issue with me also any solution?
@Arkham any updates already? just moved from cli 2 project to cli 3, since 2 wont be supported at May 31st 2023., but cant get around this issue.
@ben-fornefeld have you tried the workaround?
Looking at the log it seems to me that the
frontend
process is only being exposed inlocalhost
, but not on the other network interfaces. Your output looks like this:2023-04-25 12:04:07 │ frontend │ > Local: http://localhost:59388/ 2023-04-25 12:04:07 │ frontend │ > Network: use `--host` to expose
While mine looks like this:
2023-04-25 15:44:14 │ frontend │ > Local: http://localhost:54388/ 2023-04-25 15:44:14 │ frontend │ > Network: http://127.0.2.2:54388/ 2023-04-25 15:44:14 │ frontend │ > Network: http://127.0.2.3:54388/ 2023-04-25 15:44:14 │ frontend │ > Network: http://192.168.1.243:54388/ 2023-04-25 15:44:14 │ frontend │ > Network: http://172.16.0.2:54388/
What happens if you change
web/frontend/shopify.web.toml
to be like this?type="frontend" [commands] dev = "npm run dev -- --host" build = "npm run build"
@Arkham if you mean this one, then yea
Ok, so can you open a new issue and fill out the bug template?
I'm still investigating, but I managed to reproduce this issue with Vite <2.9 and Node 17/18/19. With other versions seems to work consistently. Probably related to this Vite issue.
If anyone is still facing this problem, could you try this?
vite
in web/frontend/package.json to ^2.9.0
npm install
Another alternative is to use Node 16 or 20.
I'll update the frontend template to require at least Vite 2.9.0 to avoid this problem in the future.
Hey @gonzaloriestra, I am running into this issue in a Shopify Remix app. There is no vite
package in my dependencies for me to try your suggestion.
Console shows this:
Browser shows this:
Attempting to load the cloudflare tunnel directly shows this:
I also tried doing a --reset
and I'm now getting this:
I'm wondering if this is related to #3065
@this-fifo now that Cloudflare is working again, do you still have those issues?
Hey @gonzaloriestra, yes the issue still persists. It also happens using ngrok
.
I tried again just now and got the same ECONNREFUSED
error
I figured out what the issue was, the error was misleading. Turns out I had a bad checkout state that caused me to have missing files in my directory.
One of the projects was importing a css file that didn't exist, basically it had a line like this:
import '../../extensions/variants-ui/assets/variant-styles-dist.css';
Removing that line that imported the non-existing file made it start working again!
The errors are quite peculiar, displaying different messages but consistently hindering the execution of npm run dev
. A workaround that appears effective involves making any changes to the code before running the command again.
We face the same error : "Error forwarding web request: Error: connect ECONNREFUSED 127.0.0.1:48983" App version: 3.58.2 Solution: File name : shopify.web.toml Added "-- --host 0.0.0.0" at the end of the [command]
like ,
[commands]
dev = "npx prisma generate && npx prisma migrate deploy && npm exec remix vite:dev -- --host 0.0.0.0"
We face the same error : "Error forwarding web request: Error: connect ECONNREFUSED 127.0.0.1:48983" App version: 3.58.2 Solution: File name : shopify.web.toml Added "-- --host 0.0.0.0" at the end of the [command]
like ,
[commands] dev = "npx prisma generate && npx prisma migrate deploy && npm exec remix vite:dev -- --host 0.0.0.0"
This worked for me! Hours of headache solved by that simple fix.
We face the same error : "Error forwarding web request: Error: connect ECONNREFUSED 127.0.0.1:48983" App version: 3.58.2 Solution: File name : shopify.web.toml Added "-- --host 0.0.0.0" at the end of the [command]
like ,
[commands] dev = "npx prisma generate && npx prisma migrate deploy && npm exec remix vite:dev -- --host 0.0.0.0"
Thank you. I am just curious why shopify cant fix this issue.
And why is this issue closed?
Please confirm that you have:
In which of these areas are you experiencing a problem?
App
Expected behavior
Shopify App homepage should open where we can enter store url to install the app
Actual behavior
Getting this error in terminal while the request times out on the browser
Error forwarding web request: Error: connect ECONNREFUSED ::1:59035
Verbose output
Reproduction steps
npm run dev
with or without-- --tunnel-url
optionOperating System
Mac OS Ventura 13.3.1
Shopify CLI version (check your project's
package.json
if you're not sure)3.45.0
Shell
iTerm2
Node version (run
node -v
if you're not sure)v19.6.0
What language and version are you using in your application?
Ruby 3.1.2