# Json from Github in a tree | embeded via runtime javascript

**URL:** <https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228>\
**Category:** Help\
**Created:** [May 6, 2024, 3:19pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228 "2024-05-06T15:19:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pixflowave](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/pixflowave/32/6310_2.png) [@Pixflowave](https://talk.observablehq.com/u/Pixflowave)\
**Post date:** [May 6, 2024, 3:19pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228/1 "2024-05-06T15:19:45Z")

</div>

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

> **[Radial tidy Tree with hyperlinks](https://observablehq.com/d/9528e737ebe4ceac)**
>
> Based on the original radial tidy tree. Here, each element that has a URL defined in the JSON table, a hyperlink will appear.

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?

---

<div class="post-metadata">

**Author:** ![dunstan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/dunstan/32/5230_2.png) [@dunstan](https://talk.observablehq.com/u/dunstan)\
**Post date:** [May 7, 2024, 6:14pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228/2 "2024-05-07T18:14:25Z")

</div>

Adding some screenshots to illustrate this:

 ![Screenshot 2024-05-07 at 11.14.00](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/f/f6a1460d766dd537a32a90db789e45f4e2eafaa7.jpeg)  
 ![Screenshot 2024-05-07 at 11.13.07](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/5/5c7ec9e68a55e4d2b1bbf899f91c5195ec8e460f.jpeg)

---

<div class="post-metadata">

**Author:** ![dunstan](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/dunstan/32/5230_2.png) [@dunstan](https://talk.observablehq.com/u/dunstan)\
**Post date:** [May 7, 2024, 8:22pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228/3 "2024-05-07T20:22:45Z")

</div>

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:

> **[Github API in Observable](https://observablehq.com/@periscopic/github-api-in-observable#cell-853)**
>
> Getting Data from Private & Public GitHub Repos into Observable This notebook provides a helper function for getting data from private or public into Observable via the GitHub API, streamlining the data ingestion process so you can focus on...

 ![Screenshot 2024-05-07 at 13.21.51](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/9/9d556ca8d5be7319587544164d62daf8306b153b.png)

---

<div class="post-metadata">

**Author:** ![Pixflowave](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/pixflowave/32/6310_2.png) [@Pixflowave](https://talk.observablehq.com/u/Pixflowave)\
**Post date:** [May 7, 2024, 9:45pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228/4 "2024-05-07T21:45:42Z")

</div>

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

> <https://github.com/Pixflowave/Neguentropie/blob/main/neguentropie.json>

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [May 8, 2024, 5:44pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228/5 "2024-05-08T17:44:49Z")

</div>

The notebook that you import from uses an Observable feature called “[Secrets](https://observablehq.com/documentation/security/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

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

```

with

```js
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

```js
Secret = null

```

and then pass that to the import:

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

```

---

<div class="post-metadata">

**Author:** ![Pixflowave](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/pixflowave/32/6310_2.png) [@Pixflowave](https://talk.observablehq.com/u/Pixflowave)\
**Post date:** [May 8, 2024, 9:35pm UTC](https://talk.observablehq.com/t/json-from-github-in-a-tree-embeded-via-runtime-javascript/9228/6 "2024-05-08T21:35:02Z")

</div>

Thank you very much
