dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.82k stars 377 forks source link

[Codespaces/JavaScript] localhost is not accessible from a polyglot notebook within GitHub Codespaces environment #3600

Open sinedied opened 3 weeks ago

sinedied commented 3 weeks ago

Describe the bug

Please provide as much information as you can.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

Screenshots

image

I have a JS notebook running in Codespaces. When I try fetching any URL through localhost from the notebook, it does not connect. I can confirm the server is running, as running curl http://127.0.0.1:11434 in a terminal works fine.

image

Is there anything I'm missing, or is this maybe related only to devcontainer/Codespaces environments?

jonsequitur commented 3 weeks ago

The Polyglot Notebooks JavaScript kernel runs in the browser, not on the server.

sinedied commented 3 weeks ago

The Polyglot Notebooks JavaScript kernel runs in the browser, not on the server.

I'm not sure what you mean by that? Even when running it on my local machine, this does not work. If I open http://127.0.0.1:11434 in my browser, this works. So even if the kernel is running in a different context that the VS Code backend, when running this locally I don't see why this should not work?

To make thing complete, even a simple call to https://www.google.com fails. I've also seen other having difficulties making HTTP call here: https://learn.microsoft.com/en-us/answers/questions/1289426/how-to-correctly-execute-requests-to-the-server-in

Being unable to make HTTP calls from a JS kernel makes it mostly useless, is there any kind of workaround for this?