Error: Unexpected token : in JSON at position 19 at provider.request.then.catch
See original GitHub issueThis is a Bug Report
Description
-
What went wrong? The deployment failed on a cryptic error looking a lot like https://github.com/serverless/serverless-google-cloudfunctions/issues/59. But my index.js is at the project’s root, so I guess it’s not the same issue ? The serverless.yml and index.js are attached.
-
What did you expect should have happened? The functions to be deployed
-
What was the config you used? Meaning ?
Similar or dependent issues:
Additional Data
- Serverless Framework Version you’re using: 1.17.0 (google-cloudfunctions 1.1.1)
- Operating System: macOS 10.12.5
- Stack Trace:
SLS_DEBUG=* sls deploy
Serverless: Packaging service...
Serverless: Compiling function "getTellUsForUser"...
Serverless: Compiling function "postTellUsVote"...
Serverless: Uploading artifacts...
Serverless: Artifacts successfully uploaded...
Serverless: Updating deployment...
Serverless: Checking deployment update progress...
Error --------------------------------------------------
Unexpected token : in JSON at position 19
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: Unexpected token : in JSON at position 19
at provider.request.then.catch (/Users/elfitz/Documents/Projects/MDE/WebServices/serverlessMDE/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:51:24)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:217:22)
at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:236:17)
at variables.populateService.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:107:33)
at runCallback (timers.js:800:20)
at tryOnImmediate (timers.js:762:5)
at processImmediate [as _immediateCallback] (timers.js:733:5)
From previous event:
at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:94:74)
at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:32:50)
at <anonymous>
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 8.1.4
Serverless Version: 1.17.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
What Is JSON and How to Handle an “Unexpected Token” Error
The first thing to do in this situation is to confirm where the error is happening exactly. To ensure the error happens on...
Read more >SyntaxError: Unexpected token < in JSON at position 0
Since it looks like the error seems to have something to do with pulling JSON data from the server, I tried starting from...
Read more >Unexpected token in JSON at position 0 - Moodle.org
This usually means that an error has been returned and that's not valid JSON. ... Turn on Debugging and (after reproducing the error)...
Read more >Unexpected token < in JSON at position 0 - MSDN - Microsoft
My first move would be to use F12 Network to inspect the http query (and the response payload). Seems you get HTML markup...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
The JavaScript exceptions thrown by JSON.parse() occur when string failed to ... data SyntaxError: JSON.parse: unexpected keyword SyntaxError: JSON.parse: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This happened to me and I was able to run with
SLS_DEBUG=*
. It turns out that not all responses are valid JSON coming back from GCP, which is the root cause of this error. I pushed a fix with #121.Fixing this breaks
sls run