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

Google sheets: clasp push command fails #743

Open jayakrishnankg opened 4 years ago

jayakrishnankg commented 4 years ago

I am trying to push Google App Scripts code to cloud using the following command:

clasp push

But it fails with the following error.

responseType: 'json', retryConfig: { currentRetryAttempt: 3, retry: 3, httpMethodsToRetry: [Array], noResponseRetries: 2, statusCodesToRetry: [Array] } }, code: 500, errors: [ { message: 'Unknown Error.', domain: 'global', reason: 'backendError' } ]

It works when I push only a few files, so I don't whether it's related to storage limit or any other issue.

I tried adding files directly to google cloud, then I encountered the following error on the last file:

We're sorry, a server error occurred. Please wait a bit and try again.

Please let me know if there is any issue with storage.

Thanks.

paxperscientiam commented 4 years ago

@jayakrishnankg any luck? Also, how did you get the error message? I'm using v2.3.0 and I'm just seeing "Push failed. Errors:".

guilhermetod commented 4 years ago

I'm suddenly getting a problem when trying to push too. But I get a differente message:

'Syntax error: Missing name after . operator. line: 29 file: server/main'

I probably already found the problematic line , but it shouldn't requerie a ".".

export { include }; export default { sa, onOpen, everyMonday }; <---- Removing this line solves the problem

I can keep the first line but not the last one. It's a TS project so they get transpiled to

exports.include = include; exports["default"] = { sa: sa, onOpen: onOpen, everyMonday: everyMonday };

I'm on WSL and it's really odd because it only fails to push if I use zsh or bash on Ubuntu. Howerver, using either powershell or windows bash successfully pushes the files, but then when I try to run any function it fails with the same message.

paxperscientiam commented 4 years ago

Unfortunately, I don't recall what the heck i did to get it working again.

@guilhermetod , i'm also doing TS stuff. You might have better luck if you migrate to V8 engine. If you can't do that, you might find that certain variables/functions aren't in the global scope.

For stuff that needs to be globally available even when bundled, there is working polyfill for globalThis:

(function() {
    if (typeof globalThis === 'object') return;
    Object.defineProperty(Object.prototype, '__magic__', {
        get: function() {
            return this;
        },
        configurable: true // This makes it possible to `delete` the getter later.
    });
    __magic__.globalThis = __magic__; // lolwat
    delete Object.prototype.__magic__;
}());

https://mathiasbynens.be/notes/globalthis

guilhermetod commented 4 years ago

I managed to get it working but I don't recall exactly which moment I got it fully working (push and execution). I can only recall that resetting my locale managed to successfully push the files and it's working on ES5.

@paxperscientiam thanks for the info btw, will try it if I run into this issue again.