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

Playground not working due to incorrect mimetype in index.js #245

Closed
parkerhancock opened this issue Nov 17, 2023 · 5 comments
Closed

Playground not working due to incorrect mimetype in index.js #245

parkerhancock opened this issue Nov 17, 2023 · 5 comments
Assignees
Labels
bug Something isn't working playground

Comments

@parkerhancock
Copy link

I can't get the playground to load when using langserve because the index.js file is served with the mimetype "text/plain" and thus my browser (Chrome/Brave/Firefox) refuse to run it. Here are the response headers as reported by Chrome DevTools:
image

So, there are two problems here:

  1. The index.js file is being served with an incorrect mimetype, causing the playground to fail, and
  2. When the playground fails, a blank page is returned.

On 2, the HTML source code for the playground endpoint looks like this:

<body>
 <div id="root"></div>
  <script>
    try {
      window.CONFIG_SCHEMA = . . .
      window.INPUT_SCHEMA = . . . 
    } catch (error) {
      // pass
    }
  </script>
</body>

And thus, when the page fails to load, because the try/catch block does nothing, no informative error message is returned.

@eyurtsev eyurtsev added bug Something isn't working playground labels Nov 20, 2023
@eyurtsev
Copy link
Collaborator

Thanks for reporting @parkerhancock

@parkerhancock
Copy link
Author

No problem! Also, if it helps, this issue is present on Windows PC's, but not Mac's. The identical example works fine on OSX.

@eyurtsev
Copy link
Collaborator

Source of issue is: https://bugs.python.org/issue43975

@eyurtsev
Copy link
Collaborator

Seems that mitigation is: https://docs.python.org/3/library/mimetypes.html#mimetypes.init

@eyurtsev eyurtsev self-assigned this Nov 27, 2023
eyurtsev added a commit that referenced this issue Nov 27, 2023
This PR fixes handling of mimetypes on windows machines:

Needed due to issue: https://bugs.python.org/issue43975

Resolves issue: #245

Chose not to use mimetypes.init since that's using a singleton pattern
and worried that users will be likely to run into issues since the
server may be parsing files which may also end up using mimetype
guessing based on file extension
@trannhatquy
Copy link

@eyurtsev how to fix the langserve playground not found error. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working playground
Projects
None yet
Development

No branches or pull requests

3 participants