Parsing date-time values from JSON fails in standard environment

35 views
Skip to first unread message

Barisere Jonathan

unread,
Nov 16, 2020, 12:10:26 PM11/16/20
to Google App Engine

Hi everyone. I am unable to parse time values from JSON when I deploy to app engine standard environment. I'm using the Go 1.14 runtime. The time values are sent in ISO-8601 (or RFC 3339) format. It works in every other environment except on app engine.
Does the app engine standard environment use a customized Go compiler? I suspect that they replace the encoding/json package for optimization purposes, but their version has a bug.
I've tested my program on both go113 and go114. If I send a time value like "2018-09-22T12:42:31Z" in JSON, I get the following error.

"invalid character 'T' looking for beginning of value"

If I remove the "T" as in "2018-09-22 12:42:31Z", I get the following error.

"parsing time \"\"2021-01-01 00:00:00.000Z\"\" as \"\"2006-01-02T15:04:05Z07:00\"\": cannot parse \" 00:00:00.000Z\"\" as \"T\""

Clearly it expects the "T", but it chokes on it. Sending only the date part doesn't work either.
I am certain that the framework I'm using (Buffalo) does not bring its own JSON parser. It uses the standard library, as I can tell from this snippet (copied below for your perusal):

// BinderFunc returns the Binder for this JSONRequestTypeBinder

func (js JSONContentTypeBinder) BinderFunc() Binder {

     return func(req *http.Request, value interface{}) error {

         return json.NewDecoder(req.Body).Decode(value)

    }

}

Jason Collins

unread,
Nov 16, 2020, 3:56:04 PM11/16/20
to Google App Engine
App Engine uses the standard compiler for Go runtimes.

Can you send a snippet of code that reproduces what you are seeing?

Elliott (Cloud Platform Support)

unread,
Nov 16, 2020, 4:46:00 PM11/16/20
to Google App Engine
Hello,

To give you more value, a code sample would help.

Barisere Jonathan

unread,
Nov 18, 2020, 2:54:56 AM11/18/20
to Google App Engine
I had this issue throughout last week, but I cannot reproduce it any longer. No dependency changed, it just stopped. Thank you for being here to help. If I encounter it again and find a way to reproduce it, I'll let you know.
Reply all
Reply to author
Forward
0 new messages