google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.59k stars 428 forks source link

clasp push -w randomly crashes #913

Closed andymelt closed 2 years ago

andymelt commented 2 years ago

Expected Behavior

I would expect clasp push -w to sit indefinitely without crashing and dumping crash information.

Actual Behavior

After random amounts of time —sometimes it happens within minutes after just a couple of pushes and sometimes it will run for hours without issue— clasp will crash and dump information about the cause. Here is an example of the output after the crash:

Error: The `onCancel` handler was attached after the promise settled.
    at onCancel (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/p-cancelable/index.js:48:12)
    at makeRequest (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/got/dist/source/as-promise/index.js:38:13)
    at Request.<anonymous> (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/got/dist/source/as-promise/index.js:143:17)
    at Object.onceWrapper (node:events:646:26)
    at Request.emit (node:events:526:28)
    at Timeout.retry (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/got/dist/source/core/index.js:1270:30)
    at Timeout.retry (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/wtfnode/index.js:197:27)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
node:events:504
      throw er; // Unhandled 'error' event
      ^

RequestError: Timeout awaiting 'request' for 25000ms
    at ClientRequest.<anonymous> (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/got/dist/source/core/index.js:962:65)
    at Object.onceWrapper (node:events:646:26)
    at ClientRequest.emit (node:events:538:35)
    at ClientRequest.origin.emit (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at TLSSocket.socketErrorListener (node:_http_client:442:9)
    at TLSSocket.emit (node:events:526:28)
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at Timeout.timeoutHandler (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/got/dist/source/core/utils/timed-out.js:36:25)
    at Timeout.timeoutHandler [as _onTimeout] (/opt/homebrew/lib/node_modules/@google/clasp/node_modules/wtfnode/index.js:197:27)
    at listOnTimeout (node:internal/timers:561:11)
    at processTimers (node:internal/timers:502:7)
Emitted 'error' event on Request instance at:
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  name: 'TimeoutError',
  code: 'ETIMEDOUT',
  timings: {
    start: 1645892658018,
    socket: 1645892658022,
    lookup: 1645892658023,
    connect: 1645892658064,
    secureConnect: 1645892658088,
    upload: 1645892658088,
    response: 1645892658168,
    end: undefined,
    error: 1645892683027,
    abort: 1645892683026,
    phases: {
      wait: 4,
      dns: 1,
      tcp: 41,
      tls: 24,
      request: 0,
      firstByte: 80,
      download: undefined,
      total: 25009
    }
  },
  event: 'request'
}

Node.js v17.5.0

I'm new to all of this stuff. This is the only project I've got, so far. The code is TypeScript and I'm editing it in Visual Studio Code. Pushing the code works great and it runs well up on script.google.com. When clasp is up and watching the project folder, it works very well. It just doesn't stay up and running (watching).

Steps to Reproduce the Problem

  1. Run clasp push -w in a project folder.
  2. Wait an indeterminant amount of time (seriously, I can't find a pattern to the amount of time or how many pushes cause this).

Specifications

This is running on an 2021 M1 MacBook Pro with 64 GB of RAM, for whatever that's worth.

bekharsky commented 2 years ago

Same on an intel macbook

kenkku commented 2 years ago

Same here (#909)

killinsun commented 2 years ago

Do you still get this issue? I had same and tried downgrade to 2.4.1 -> 2.3.0, It works well for now.

Node version: 16.14.2 OS: Mac 12.3.1 (M1 2020 MBP)

markstreich commented 2 years ago

I had same and tried downgrade to 2.4.1 -> 2.3.0, It works well for now.

Downgrading to 2.3.0 worked for me too.

Haven't touched clasp in a month or so, and had zero issues before (same machine, did not upgrade clasp in that time). For me, it's not random as described in the original post. Happens consistently about 30 seconds after starting (clasp push --watch).

Mac 12.3.1 (M1Max 2021 MBP)

➜  ~ npm -v
8.3.1
➜  ~ node -v
v16.14.0
cyrusn commented 2 years ago

Same issue here, the onCancel error appear on every sub command. Feeling annoyed.

npm -v
8.8.0

node -v
v18.0.0
eka05 commented 2 years ago

Help me please

PS E:\Clasp Google Script> clasp push

PS E:\Clasp Google Script> clasp push drive.google.com ✖ Error: Looks like you are offline.

No valid E:\Clasp Google Script.clasp.json project file. You may need to create or clone a project first.

No valid E:\Clasp Google Script.clasp.json project file. You may need to create or clone a project first. PS E:\Clasp Google Script> clasp push -w console.cloud.google.com ✖ drive.google.com ✖ Error: Looks like you are offline.