Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframe CORS error #1172

Closed
laszlokorte opened this issue May 6, 2022 · 8 comments · Fixed by #1174
Closed

iframe CORS error #1172

laszlokorte opened this issue May 6, 2022 · 8 comments · Fixed by #1174

Comments

@laszlokorte
Copy link

Environment

  • Elixir & Erlang/OTP versions (elixir --version): Elixir 1.13.3, Erlang/OTP 24 [erts-12.0]
  • Operating system: Windows 10
  • How have you started Livebook (mix phx.server, livebook CLI, Docker, etc): livebook server
  • Livebook version (use git rev-parse HEAD if running with mix): 0.6.0
  • Browsers that reproduce this bug (the more the merrier): Firefox, Edge, Chrome
  • Include what is logged in the browser console: TypeError: NetworkError when attempting to fetch resource.
  • Include what is logged to the server console: Nothing

Current behavior

VegaLite do not render.

Chromes displays the most detailed error in the browser console:

Access to fetch at 'http://localhost:8081/iframe/v3.html' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Fetching http://localhost:8081/iframe/v3.html manually via curl or Browser results in a HTTP 404 "Not Found".

I noticed that there are existing issues #1014 and #971 describing a similar error but it looks like the issue was to be fixed in version 0.6.0. For me the issue persists. Deleting Path.join(System.tmp_dir!(), "livebook") did not work for me.

Expected behavior

I expect the plots render and no CORS error to occur.

@josevalim
Copy link
Contributor

Is there something else running on port 8081? What happens if you curl the root?

@laszlokorte
Copy link
Author

laszlokorte commented May 6, 2022

Nothing else listens on 8081. While livebook is running GET http://localhost:8081 gives me a 404 as well. If livebook is not running GET http://localhost:8081 times out.

@laszlokorte
Copy link
Author

laszlokorte commented May 6, 2022

Running via dockers works as expected. Via docker GET http://localhost:8081 still gives a 404 not found but http://localhost:8081/iframe/v3.html gives an html file with some javascript.

@josevalim
Copy link
Contributor

Does http://localhost:8081/iframe/v2.html work for you locally?

@laszlokorte
Copy link
Author

laszlokorte commented May 6, 2022

Maybe I am doing something wrong but:

When running livebook via docker (Docker Desktop on Windows) both http://localhost:8081/iframe/v2.html and http://localhost:8081/iframe/v3.html work from inside the Browser on the Windows machine.

When running livebook on Windows itself via $ livebook server none of the v2/v3 iframes work but http://localhost:8080 does.

Now if I attach to the docker container itself wget -O - http://localhost:8081/iframe/v2.html (and v3) does give a 404 as well, but wget -O - http://localhost:8080/ does work.

@jonatanklosko
Copy link
Member

Oh, the hex package doesn't include the iframes :( I didn't notice it when testing livebook from hex, because the iframes got cached. Fixed in #1174, though we need a new version.

@laszlokorte
Copy link
Author

Thank you both for your quick replies! #1174 fixed it for me 😊

@jonatanklosko
Copy link
Member

I've just released 0.6.1, should work as expected from Hex :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants