Embedding team notebook using API key - doesn't work

Hey All,

I am following https://observablehq.com/@observablehq/downloading-and-embedding-notebooks and tried embedding my team notebook with the URL which uses previously generated API key. This gives blank page. When I query my notebook directly (via https://api.observablehq.com/) I can see the module code in the browser. Not sure what the problem is (maybe this is because my notebook uses DatabaseClient) but this is a block for us. I can try another solution to use custom local proxy, but it is way more complex. Thanks for the help!

Also, replaced location for my module to be locally served JS file and getting now:
test.js:2 GET http://localhost:8000/@jashkenas/inputs.js?v=3 net::ERR_ABORTED 404 (File not found)

I feel I do something fundamentally wrong. Seems like module export doesn’t pull all dependencies and they need to be manually provided?

Hi @dbuzz123,

Yes, API keys do not currently grant access to DatabaseClients or Secrets. Notebook embeds are intended to be statically cacheable and self-contained, and DatabaseClients and Secrets depend on the Observable API to function.

With that said, we currently have an open discussion about potentially extending API keys to securely allow them access to resources like DatabaseClients and Secrets. If you could describe your use case here in a bit more detail, it could help inform the design of any future changes…

Hey @jashkenas I outlined to you our use case on our video chat: I am extracting data from BQ into heatmap type of visualization with the end goal to present only visualization itself for business consumers. So embedding selected cell would have been an ideal solution. Current integration through DatabaseClient is effectively limited to the whole notebook, which is not what we want to show for non-technical folks.

Also, seems like embedding doesn’t actually work even w/o use of Database Client. Here is I am trying to embed simple NB and getting blank screen. Interestingly, when I download the code and run it I see the Notebook. I use python http.server. Network log shows everything is downloaded w/o any issues, but no content is shown:

Hi @dbuzz123. It looks like you’re loading an old version of the Observable runtime. (It was renamed from notebook-runtime to runtime some time ago.) Which instructions are you following, and do you mind sharing your code? (The Downloading and Embedding notebook has the up-to-date instructions in it.) You can message me privately if you don’t want to post it publicly.

1 Like

Hi @mbostock, Thanks for the input and pointing out the old runtime! I am pretty sure I took it from some other samples rather than from the referred notebook itself. The NB is now loading with the new runtime (albeit giving errors about failure to resolve some variables/functions).

Glad you got it working. If you find anything of ours that still references the old runtime, let us know and we’ll update it!