clasp: "Error: Request contains an invalid argument" on push and deploy

Expected Behavior

Push code to script project

Actual Behavior

Request fails on clasp push and on clasp redeploy. Redeploy has a more verbose error report:

    at new RequestError (/usr/lib/node_modules/@google/clasp/node_modules/google-auth-library/lib/transporters.js:34:42)
    at Request._callback (/usr/lib/node_modules/@google/clasp/node_modules/google-auth-library/lib/transporters.js:96:27)
    at Request.self.callback (/usr/lib/node_modules/@google/clasp/node_modules/request/request.js:186:22)
    at Request.emit (events.js:159:13)
    at Request.<anonymous> (/usr/lib/node_modules/@google/clasp/node_modules/request/request.js:1163:10)
    at Request.emit (events.js:159:13)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/@google/clasp/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:254:19)
    at IncomingMessage.emit (events.js:164:20)
    at endReadableNT (_stream_readable.js:1062:12)
  code: 400,
  errors:
   [ { message: 'Request contains an invalid argument.',
       domain: 'global',
       reason: 'badRequest' } ] }

The auth library fails, so i tried logging back in and out and into another account to no avail

Steps to Reproduce the Problem

  1. My current project directory looks like:
├── appsscript.json  
├── build  
├── node_modules  
├── package.json  
├── package-lock.json  
├── README.md  
└── src  

With src and build as directories. The main apps script in my project is called build/Main.gs and should be pushed from the build directory. 2. My build system is currently just using babel to transpile syntax and perform a simple bundle of the src directory. Besides that, I don’t know what’s out of the ordinary with my project. My Google account is personal, not organizational, so the auth issues don’t come from that…

Specifications

  • Node version (node -v): v9.3.0
  • Version (npm list | grep clasp): @google/clasp@1.0.7
  • OS (Mac/Linux/Windows): Windows 10, WSL running Ubuntu 16.04

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

Per https://github.com/google/clasp/issues/21#issuecomment-394829151, I created a basic appsscript.json JSON validator in https://github.com/google/clasp/commit/80f3f7c1acae4171c00af4ec97356bf0d5ff4abf.

It looks like this:

clasp push
Error: Your appsscript.json contains invalid JSON.

It only detects JSON errors like a trailing comma.

If anyone else looks through this thread for the mysterious “Error: Request contains an invalid argument” , the issue that caused me recently to get this same error was that I did not have my .git file entered in the .claspignore file. If you have a .git file in that directory, you’ll want to place it in your .claspignore file.

Great! I do need to document .claspignore. A PR would help. Mind adding a section about .claspignore? Something like:

How To…

Ignore Files

… Create a file called .claspignore … it uses anymatch