-
Notifications
You must be signed in to change notification settings - Fork 115
JSON payload not being parsed correctly on Windows Shell #90
Comments
I've updated the docs and the CLI's help text with Windows-specific instructions. |
I have tried the backslash workaround, does not work. This is what I see with 1.0 alpha 25: I found out that I could instead do the following on Win 10: |
So on windows the surrounding single quotes are what made it work for you? |
@jmdobry yes, without equal (=) sign |
I updated the docs, thanks. |
HI It is still not working and I am getting below error D:\gcp_demo\functionTraining\http>functions call helloWorld --data '{"message":"Hello, World"}' Thanks in Advance !! |
It doesn't like the wrapping single quotes for me. This works: |
Description
Specifying an inline JSON payload will not work on a Windows shell if one follows the recommended CLI usage pattern. An error
is emitted.
The recommended CLI usage is
functions call helloWorld --data='{"foo":"bar"}'
The recommended command works fine when using Git Bash on Windows. However, it does not work when using the Google Cloud SDK Shell on Windows nor on the Windows Command Prompt; the aforementioned error will be thrown.
To see how the JSON is parsed, add
console.log(process.argv);
in the file /bin/functions. It becomes ''{foo:bar}'' which is indeed not valid JSON. It should be '{"foo":"bar"}' instead.This problem may be related to #34 , but the problem is for
call
rather thandeploy
.Steps to reproduce
Invoke
functions call helloWorld --data='{"foo":"bar"}'
using the Google Cloud SDK Shell on Windows or using the Windows Command Prompt.Workaround
When using a Windows shell, call
functions call helloWorld --data={\"foo\":\"bar\"}
instead.Note that this workaround is not compatible with Bash on Windows.
Thanks!
The text was updated successfully, but these errors were encountered: