🏠 back to Observable

fetch error in notebook


I’m writing a fetch query but get an error in the notebook. I check the browser’s Network tab. The request returns 200 with a valid response. But in the notebook, I get an error:

SyntaxError: Unexpected end of input

fetch("https://www.bitmex.com/api/v1/trade?symbol=.BVOL&count=100&columns=price", {
  headers: {"content-type": "application/json"},
  mode: "no-cors"
}).then(response => {
  return response.json();

What is the difference between the browser’s network request and the notebook?


Hi @dnprock, it seems like they don’t offer CORS on their public API for security reasons.

But you can use a proxy. I’ve setup one for you on glitch. You can run this on Observable now, there will be a few seconds to warmup glitch

data = await fetch(
).then(r => r.json())

Here is the source code on glitch

1 Like

Heh, seeing your comment jogged my memory.

@radames @bgchen thanks for the reference.