Change:
Originally filed here Problem: Notebook kernel pre-load scripts are now defined statically via the contribution However VS Code throws a 401 error when loading resources from within the Jupyter extension, If however we have a dummy script file (in the Jupyter extension directory) that is defined as a in the VS Code API , then all resources from Jupyter extension directory are loaded I.e. using the above API in some way registers the Juptyer extension directory as a supported for scripts, and using the static contribution does not.
I have a work around in the Jupyter extension right now, i've a dummy placeholder script that does nothing,
Can you share steps to reproduce this with the fix in place? Also, does this happen on normal desktop too, or only sshe Unclear why this is not working as we should add preloads to the local resource roots:
Here are the steps Install Python Install VS Code insiders and latest pre-release versions of Jupyter and Python NOTE: Install the pre-release version of Jupyter extension that is 2 days old Add the following setting into vscode Create a python env and install the following dependencies You can use the command to create a directory with Pytohn in a particular workspace folder (optionally you can use Python extension to do this for you) Run the following code in a notebook pointing to the above venv (i.e. select the above venv as a kernel) You might get prompted to enable CDN download, hit cancel for that The widget will not load, network tab in vscode will display a 401 error Note: This is now working in the latest pre-release version of Jupyter extension
I believe the broken version is be but I'm having trouble reproducing this The output either never renders anything (but there is no network error) or renders as an image: ! ! Any other steps?
Not sure which pre-release to use anymore, as the pre-release has changed since Please use the vsixc from this build (check the artifacts for the vsix) here is the Install Python Add the following setting into vscode (reload VSCode) Create a python env and install the following dependencies You can use the command to create a directory with Pytohn in a particular workspace folder (optionally you can use Python extension to do this for you) Run the following code in a notebook pointing to the above venv (i.e. select the above venv as a kernel) You might get prompted to enable CDN download, hit cancel for that The widget will not load, network tab in vscode will display a 401 error !
I'm still unable to reproduce this issue Are you running the jupyter out of sources by chance or have you patched VS Code/jupyter in some other way? The path to the resource we a trying to load looks weird: . This looks like an extension development path In normal installs, we should load resources from a path that looks more like: If you are able, you can also try and sharing the result of that function compared to the path of the js file we try loading in the webview
This issue has been closed automatically because it needs more information and has not had recent activity. See also our guidelines. Happy Coding!
information was provided
lets you specific an additional set of localResourceRoots that should be allowed when loading the preload. Can you please try adding these for the python static preload contribution? Let me know if fixes the problem!
Thanks , seems to work,
Changes were made upstream in VS Code, marking as verified.

Discussion:
const NotebookPreloadContribution = Object.freeze({ type: 'type', entrypoint: 'entrypoint', <ins> localResourceRoots: 'localResourceRoots', </ins> }); interface INotebookPreloadContribution { readonly [NotebookPreloadContribution.type]: string; readonly [NotebookPreloadContribution.entrypoint]: string; <ins> readonly [NotebookPreloadContribution.localResourceRoots]: readonly string[]; </ins> } const notebookProviderContribution: IJSONSchema = {

type: 'string', description: nls.localize('contributes.preload.entrypoint', 'Path to file loaded in the webview.'), }, <ins> [NotebookPreloadContribution.localResourceRoots]: { type: 'array', items: { type: 'string' }, description: nls.localize('contributes.preload.localResourceRoots', 'Paths to additional resources that should be allowed in the webview.'), }, </ins> } } };

type, extension: extension.description, entrypoint: notebookContribution.entrypoint, <ins> localResourceRoots: notebookContribution.localResourceRoots ?? [], </ins> })); } }

return [ this.notebookService.getNotebookProviderResourceRoots(), this.notebookService.getRenderers().map(x => dirname(x.entrypoint.path)), <del> Array.from(this.notebookService.getStaticPreloads(this.notebookViewType), x => dirname(x.entrypoint)), </del> <ins> ...Array.from(this.notebookService.getStaticPreloads(this.notebookViewType), x => [ dirname(x.entrypoint), ...x.localResourceRoots, ]), </ins> workspaceFolders, notebookDir, this.getBuiltinLocalResourceRoots()

readonly type: string; readonly entrypoint: URI; readonly extensionLocation: URI; <ins> readonly localResourceRoots: readonly URI[]; </ins> } export interface IOrderedMimeType {

readonly type: string; readonly entrypoint: URI; readonly extensionLocation: URI; <ins> readonly localResourceRoots: readonly URI[]; </ins> constructor(descriptor: { readonly type: string; readonly entrypoint: string; <ins> readonly localResourceRoots: readonly string[]; </ins> readonly extension: IExtensionDescription; }) { this.type = descriptor.type; this.entrypoint = joinPath(descriptor.extension.extensionLocation, descriptor.entrypoint); this.extensionLocation = descriptor.extension.extensionLocation; <ins> this.localResourceRoots = descriptor.localResourceRoots.map(root => joinPath(descriptor.extension.extensionLocation, root)); </ins> } }