question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Unexpected token : in JSON at position 19 at provider.request.then.catch

See original GitHub issue

This 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

serverless.yml.zip index.js.zip

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
pickypgcommented, Sep 27, 2018

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.

1reaction
PatrickHeneisecommented, Mar 27, 2018

Fixing this breaks sls run

Failed to configure the Event Gateway. Failed to configure the Event Gateway. Failed to subscribe the event http to the function vessels-list due the error: Subscription doesn't validate. Validation error: "Missing required fields (method, path) for HTTP event."
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found