Skip to content

Google Cloud Functions Cloud Datastore sample error #929

Description

@jamie-chapman

The tutorial in https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/functions/datastore

Example appears to not accept the sample JSON object in the function "gcloud functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description":"Buy milk"}}'".

The error below is given.

ERROR: (gcloud.functions.call) Invalid value for [--data]: Is not a valid JSON: No JSON object could be decoded

Activity

  1. changed the title [-]Google Cloud Functions Cloud Datastore sample[/-] [+]Google Cloud Functions Cloud Datastore sample error[/+] on Nov 23, 2018
  2. fhinkel commented on Nov 26, 2018

    @fhinkel
    Contributor

    Hi 👋 . Thanks for reporting the issue. I can't reproduce the error. Are you using the newest gcloud version (Google Cloud SDK 226.0.0)?

    gcloud functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description":"Buy milk"}}'
    executionId: **********
    result: Entity Task/sampletask1 saved.
  3. jamie-chapman commented on Nov 26, 2018

    @jamie-chapman
    Author

    Hi! Yes I am using version 226.0.0
    gcloud --version Google Cloud SDK 226.0.0 alpha 2018.11.09 bq 2.0.38 core 2018.11.16 gsutil 4.34

    Also using Node version v10.13.0 and Windows 10 version 1709, OS Build 16299.785

  4. fhinkel commented on Nov 26, 2018

    @fhinkel
    Contributor

    Could you post the full command that you tried? Everything worked fine for me when I copied the instructions. Do you have the API enabled?

  5. jamie-chapman commented on Nov 29, 2018

    @jamie-chapman
    Author

    Yes the API is enabled, I have since successfully created some Cloud functions that read JSON data and create an entity in Datastore.
    Here's a trace of the commands I used for the example:
    \nodejs-docs-samples-master\nodejs-docs-samples-master\functions\datastore
    gcloud functions deploy get --trigger-http
    gcloud functions deploy set --trigger-http
    gcloud functions deploy del --trigger-http
    gcloud functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description":"Buy milk"}}'

    ERROR: (gcloud.functions.call) Invalid value for [--data]: Is not a valid JSON: No JSON object could be decoded

  6. fhinkel commented on Nov 29, 2018

    @fhinkel
    Contributor

    Strange, following the same example I can't reproduce the error. But you're able to create other cloud functions?

  7. added a commit that references this issue on Nov 16, 2022
  8. added a commit that references this issue on Nov 16, 2022
  9. added a commit that references this issue on Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions