Json from Github in a tree | embeded via runtime javascript

Hello, I’m very happy to have made this journey.

I want to embed via Javascripte runtime api but I get this error message :

chartz = RuntimeError: Secret is not defined
Technè = RuntimeError: Secret is not defined

Where to define the secret?

Adding some screenshots to illustrate this:


It looks like you’re importing a notebook that does use a secret, by using import {gh} from "@periscopic/github-api-in-observable" at the bottom of your notebook.

That same notebook has instructions on how to adapt it for your own use and define your own secret:

TY, I had understood that this only concerned the private repository on github, but my file is public.

The notebook that you import from uses an Observable feature called “Secrets” which is not available in public notebooks or JavaScript embeds. For what it’s worth you don’t actually need to import gh:

Simply replace

Technè = gh("https://github.com/Pixflowave/Neguentropie/blob/main/neguentropie.json")
  .then(response => response.json())

with

Technè = fetch("https://raw.githubusercontent.com/Pixflowave/Neguentropie/main/neguentropie.json")
  .then(response => response.json())

The notebook itself doesn’t show any errors because of how the Secret function itself is provided:

  • in a public notebook Secret is present but will throw if invoked,
  • but when instantiating the Runtime directly Secret is not declared at all and therefore a missing dependency.

One workaround that can be applied to the notebook directly is to define a cell

Secret = null

and then pass that to the import:

import {gh} with {Secret} from "@periscopic/github-api-in-observable"
1 Like

Thank you very much