cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: Process aborts when requests last longer than 15 seconds

Open jackwuzz opened this issue 8 months ago • 13 comments

Please confirm that you have:

  • [x] Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • [x] Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

https://shopify.dev/docs/storefronts/themes/getting-started/create I am on the Doc for Getting-started.

Command

shopify theme dev --store XXXXXX

Image

Actual behavior

Running the command "shopify theme dev --store XXXX". It shows Logged in successful, but after that error msg show "The user aborted a request."

Image

Verbose output

Verbose output
➜  shopify shopify theme dev --store TGM-Test-Store  

To run this command, log in to Shopify.
User verification code: ZBSW-BMKK
👉 Press any key to open the login page on your browser
Opened link to start the auth process: https://accounts.shopify.com/activate-with-code?device_code%5Buser_code%5D=ZBSW-BMKK
✔ Logged in.
╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  The user aborted a request.                                                 │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Reproduction steps

The account I used is the store owner, the same email address for developer Partner.

Operating System

Mac Os

Shopify CLI version (shopify --version)

@shopify/cli/3.77.1 darwin-x64 node-v22.14.0

Shell

No response

Node version (run node -v if you're not sure)

v22.14.0

What language and version are you using in your application?

No response

jackwuzz avatar Apr 08 '25 09:04 jackwuzz

I've been having the same annoying issue. I usually notice it when working on bigger projects where there are a lot of .json templates that have lots of content.

djordje-st avatar Apr 08 '25 10:04 djordje-st

Yup, same here when trying to run a remix app with shopify app dev. Stack trace:

AbortError: The user aborted a request.
    at abort (file:///Users/janpeltner/.nvm/versions/node/v22.14.0/lib/node_modules/@shopify/cli/dist/chunk-7TDJWEEF.js:17571:23)
    at AbortSignal.abortAndFinalize (file:///Users/janpeltner/.nvm/versions/node/v22.14.0/lib/node_modules/@shopify/cli/dist/chunk-7TDJWEEF.js:17579:11)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)
    at AbortSignal.dispatchEvent (node:internal/event_target:762:26)
    at runAbort (node:internal/abort_controller:447:10)
    at abortSignal (node:internal/abort_controller:433:3)
    at Timeout._onTimeout (node:internal/abort_controller:153:7)
    at listOnTimeout (node:internal/timers:594:17)
    at process.processTimers (node:internal/timers:529:7)

CLI version: @shopify/cli/3.77.1 darwin-arm64 node-v22.14.0

EDIT: The issue is fixed for me when I downgrade to the following CLI version: @shopify/cli/3.76.2 darwin-arm64 node-v22.14.0

Maybe it has something to do with this CLI-Kit feature that's been introduced with 3.77.0? 👀

Automatic cancellation of slow network requests

jan-peltner avatar Apr 08 '25 10:04 jan-peltner

Great catch @jan-peltner! I think you're right that this is terminating as a result of that change.

The default behaviour introduced here will terminate a request after 15 seconds.

Can you try bumping up SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS=30 or SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS=60 and letting me know if that resolves your issue?

That'll help us determine what the best way forward, thanks!

@jackwuzz @djordje-st @jan-peltner

jamesmengo avatar Apr 08 '25 21:04 jamesmengo

@jamesmengo I tried both variables but end up with the same result:

Image

djordje-st avatar Apr 09 '25 06:04 djordje-st

@djordje-st how did you add the flag into the cli command please, going through the same issue and have tried to use a "shopify.theme.toml" for theme dev. cannot find the flags to use for this. thank you

support-smartebusiness avatar Apr 09 '25 07:04 support-smartebusiness

@support-smartebusiness I tried adding them as variables in my .bashrc file, and I tried running the CLI with the variable before: SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS=60 shopify theme push -u -t test-theme

djordje-st avatar Apr 09 '25 08:04 djordje-st

We are also facing the same issues within our deployment pipeline. Will check whether the environment variables fix it.

Update: It did not help.

Image

larsschellhas avatar Apr 14 '25 15:04 larsschellhas

Sorry everyone! I was mistaken. The timeout needs to be provided in milliseconds, rather than seconds. Can you try 30,000 instead, and bumping it up if that still doesn't work + reporting back please?

I'm going to still investigate a platform-level fix for this, but I'm hoping that can unblock you in the meantime. Thanks for the patience folks!

Note: You may get a socket connection error - if that's the case, please update this thread with verbose logs!

jamesmengo avatar Apr 14 '25 22:04 jamesmengo

How can I modify SHOPIFY-CLI_SMAX-REQUEST_TIME-FOR-NETWORK_CLLS ?

Sorry everyone! I was mistaken. The timeout needs to be provided in milliseconds, rather than seconds. Can you try 30,000 instead, and bumping it up if that still doesn't work + reporting back please?

I'm going to still investigate a platform-level fix for this, but I'm hoping that can unblock you in the meantime. Thanks for the patience folks!

Note: You may get a socket connection error - if that's the case, please update this thread with verbose logs!

zhangsanfeng-dna avatar Apr 15 '25 06:04 zhangsanfeng-dna

I am having the same issue on my mac having had to replace my hard drive and update to the latest OS. I have spent 5 hours trying to install different many versions but to no avail. I think I used to have v2 before but can't seem to install that anymore, so gonna have to keep trying with v3x.

UPDATE: Having tried many different versions, got this one to work: 3.70.0 npm install -g /[email protected]

Thanks to this thread: https://community.shopify.com/c/shopify-discussions/can-run-shopify-theme-dev-on-the-latest-version-of-shopify-cli-3/m-p/2868197#M484569

annaweaver avatar Apr 23 '25 13:04 annaweaver

@annaweaver @jackwuzz I confirm, downgrade to 3.70.0 will solve this issue

nfxpnk avatar Apr 24 '25 06:04 nfxpnk

I have the same problem. After logging in successfully, it says aborted.

Image

lincycode avatar Apr 30 '25 03:04 lincycode

v3.79.0 fixed it for me.

eliottparis avatar May 05 '25 14:05 eliottparis

@EvilGenius13 there's another user facing this error when running theme dev with the latest version. This is what the verbose log shows:

2025-05-12T20:08:14.805Z: File Upload Results:
-config/settings_data.json: success
2025-05-12T20:08:23.926Z: Retrying request to https://xxx.myshopify.com/admin/api/2025-04/graphql.json due to network error FetchError: request to https://xxx.myshopify.com/admin/api/2025-04/graphql.json failed, reason: socket hang up
2025-05-12T20:08:23.926Z: Request to https://xxx.myshopify.com/admin/api/2025-04/graphql.json completed in 15242 ms
With response headers:
    
2025-05-12T20:08:23.938Z: Failed to perform the initial theme synchronization.
FetchError: request to https://voice-of-defiance.myshopify.com/admin/api/2025-04/graphql.json failed, reason: socket hang up
    at ClientRequest.<anonymous> (file:///home/xxx/.nvm/versions/node/v21.5.0/lib/node_modules/@shopify/cli/dist/chunk-JED5Q5EJ.js:17594:18)
    at ClientRequest.emit (node:events:519:28)
    at ClientRequest.emit (node:domain:488:12)
    at TLSSocket.socketOnEnd (node:_http_client:519:9)
    at TLSSocket.emit (node:events:531:35)
    at TLSSocket.emit (node:domain:488:12)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Could you please have a look? It seems it's still failing after 15s.

gonzaloriestra avatar May 14 '25 12:05 gonzaloriestra

Reopen, the issues are still happening it is not resolved

vitalii-panama avatar May 22 '25 11:05 vitalii-panama

Hi @vitalii-panama, is this happening when running theme dev or other commands?

EvilGenius13 avatar May 22 '25 13:05 EvilGenius13

I have a snap build of the fix for anyone to test if it fixes the theme dev issues they are experiencing. pnpm i -g @shopify/[email protected]

EvilGenius13 avatar May 22 '25 18:05 EvilGenius13

VERSION @shopify/cli/3.80.1 darwin-arm64 node-v20.16.0 i have the same error is there any config file to change the timeout?

gh-darvishani avatar May 23 '25 05:05 gh-darvishani

Hi @gh-darvishani would you be able to try this snap build of the fix and let me know if it works? pnpm i -g @shopify/[email protected]

EvilGenius13 avatar May 23 '25 14:05 EvilGenius13

@EvilGenius13 got this error : npm i -g @shopify/[email protected]

npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

changed 26 packages in 31s

gh-darvishani avatar May 23 '25 14:05 gh-darvishani

@EvilGenius13 got this error : npm i -g @shopify/[email protected]

npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

changed 26 packages in 31s

That's okay, you just got a warning. the changed 26 packages in 31s part shows it installed. You can double check by running shopify --version and you should see something like @shopify/cli/0.0.0-snapshot-20250522153309 darwin-arm64 node-v22.14.0

EvilGenius13 avatar May 23 '25 14:05 EvilGenius13

@EvilGenius13 got this error. also i had the same error request to https://scf26q-iq.myshopify.com/admin/api/2025-04/graphql.json │ │ failed, reason: socket hang up

is there any way to changethe timeout?

gh-darvishani avatar May 23 '25 14:05 gh-darvishani

@EvilGenius13 got this error. also i had the same error request to https://scf26q-iq.myshopify.com/admin/api/2025-04/graphql.json │ │ failed, reason: socket hang up

is there any way to changethe timeout?

The timeout on calls that had the error such as Failed to perform the initial theme synchronization. are set to 90 seconds using that build I shared. If you are getting a socket hang up, it appears to be a different symptom where the connection might be have some instability or another issue. I will continue to look into it.

EvilGenius13 avatar May 23 '25 17:05 EvilGenius13

it seems my theme is a little heavy. i tried to use --only /foldername and change my internet connection. at the end,I could fix my issue, but still can't find any setting to change the connection timeout thanks for your help

gh-darvishani avatar May 23 '25 18:05 gh-darvishani

Same error. I tried many different CLI versions and node versions nothing working. The webpack complies, node is fine but the CLI not synch with the local and the process exit with the same User aborted the request message as for everyone.

Image

CselikSimba avatar May 28 '25 19:05 CselikSimba

you can rewrite your webpack.dev.js to not hang up but the issue still prevent any update to the server, its just not dropping the connection but not updating either.

CselikSimba avatar May 28 '25 19:05 CselikSimba

v3.79.0 fixed it for me.

it seems really random. My colleague use it with 3.79.1 and that's working from him but for me none of the versions helped so far. I used to got this error a week ago but then I thought a node update will help and it let me in after I thought it solved it but seems I just got a lucky number for that session as I cant make it work since I terminated that.

CselikSimba avatar May 28 '25 19:05 CselikSimba

If anyone is still getting errors, I would love to grab the request ID so that I can do more digging.

EvilGenius13 avatar Jun 03 '25 18:06 EvilGenius13

If anyone is still getting errors, I would love to grab the request ID so that I can do more digging.

I am getting this issue. I do not always get a request ID.

First time I ran shopify app dev it ran fine and then closed. Second time I had to auth again and then it hung up after login. Then I got a 500 response. Now I just get "The user aborted a request"

Request ID: 245b1c66-f016-40f1-bb0b-35558ab9dd83-1749164772 Request ID: 1c850f15-bf1e-450a-98cc-44f2ff88b9e7-1749164732

These are the only two times I have gotten a request id back. More times I get "The user aborted a request"

It was working fine a few days ago, nothing changed code wise but now this is a problem today.

popovidis avatar Jun 05 '25 23:06 popovidis

Why this issue is closed?

nfxpnk avatar Jun 05 '25 23:06 nfxpnk