JSON Endpoint Example 1 not working for me


#1

I duplicated

JSON Endpoint Example 1
https://runkit.com/runkit/json-endpoint-example-1

as my testing notebook,
https://runkit.com/suntong/json-endpoint-demo1

but why it is not working for me?

I.e., the https://runkit.io/runkit/json-endpoint-example-1/branches/master?url=http://google.com works just fine, however, my url,
https://runkit.io/suntong/json-endpoint-demo1/branches/master?url=http://google.com just returns an empty

{}

even after I’ve changed the return to,

return {
    title: page("title").text() || "no title",
    ok: true
}

and here is the response log that I see (note the content-length: 2):

HEADERS
access-control-allow-origin: *
access-control-expose-headers: tonic-rate-limit-remaining
connection: close
content-length: 2
content-type: application/json; charset=utf-8
date: Sun, 04 Feb 2018 04:54:18 GMT
etag: W/"2-mZFLkyvTelC5g8XnyQrpOw"
runkit-rate-limit-remaining: 9999
vary: Accept-Encoding
x-powered-by: runkit.com

Anyone can help please?


#2

Hi there,

Sorry about that.

It’s not obvious to me right now why it’s broken, but if you switch to an older version of Node, it will work. It looks like anything after Node 6 no longer works.

– Randy


#3

So I switched to the same version of Node, and now it’s working.

Thanks for your help, Randy!