Cant Export JOSN to Runkit Endpoint

Hello, I’m trying to export a JSON object to the Runkit endpoint but I keep getting a 500 error. ayn suggestions how can I get this working?

Hi @lukejamison

The endpoint function in your code is trying to access a scoped variable from the callback function.
I’ve changed the code a bit to make it work (

Please rotate your API key as it currently exposed in your notebook logs

Hope that helps,

Hello @sherlock

So that code is not working and I’m getting this error message when I go to the end point

"error": "runtime_error",
"message": "TypeError: e is not a function",
"stack": [
"TypeError: e is not a function",
"    at t.default (/app/available_modules/1563075741541/set-immediate-interval/dist/index.js:1:1239)",
"    at exports.endpoint (evalmachine.<anonymous>:15:9)",
"    at handleRequest (runkit-runtime:4512:26)",
"    at Server.<anonymous> (runkit-runtime:4397:13)",
"    at Server.emit (events.js:198:13)",
"    at parserOnIncoming (_http_server.js:677:12)",
"    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)"

Any suggestions on how to fix that? Also, I have changed Api Key any way to hide it?

Weird… I don’t recall requiring the set-immediate-interval" module.
Anyway, I fixed the code, it should work now (with a valid API key).

In regards to hiding your API key, the reason I was able to see it was that you shared the notebook and logged the request object that contained the key in the request parameters.

You can avoid that by not logging objects that may contain sensitive data.
Also, avoid making such notebooks public.


1 Like

Hello @sherlock

Thanks for that information. Also do you know how to put a space between 2 variables when creating JSON i have the code below and I need a space after the comma where lng1 and lat1 are. Because when I look at the JSON via the endpoint there is no space. Also how can I have this request run every 30 seconds? Or 60 is fine.

response.end(JSON.stringify({ geomerty: { type: "Point", coordinates: [lng1, lat1]}, type: "Feature", properties:{}}));