Hi!
I am trying to embed some of my Observable notebooks into an internal dashboard I am building. I am using the Observable teams feature and the notebooks that I’m trying to embed are shared across the team. The data is coming from the API that we built and I am using React as a frontend framework for embedding these notebook. I am facing few issues while doing this and seeking your help.
- I am not able to install the notebooks as a NPM module
This is how I’m trying to install the notebook: npm i https://api.observablehq.com/d/cc500855cdb11a74@48.tgz?v=3&api_key=xxxxxxxx
but apparently NPM does not accept the api_key
argument in the command. the second approach I tried for this is to wrap the URL in the double quotes like this npm i "https://api.observablehq.com/d/cc500855cdb11a74@48.tgz?v=3&api_key=xxxxxxxx"
now the command works but it is not able to find the module, it gives me this error: npm ERR! 404 Not Found
it works if the notebook is public, but in my use case I cannot make the notebook public, it has to be private because of the sensitive data.
-
Secret()
function does not work for the embedded notebook
So for now I have downloaded the tar ball file of the notebook and then installed it as NPM module, but now the Secret()
function is not working, it is giving me error: viewof SpeedChart = RuntimeError: Secret is not defined
and this is how I am using the Secret()
function in my notebook: https://api.mydomain.com/dataapi/api/rest/someapiname/fetch?userid=${Secret( "dev_user" )}&apikey=${Secret("api_key")}