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

fix: static files mounting bug #1746

Merged
merged 3 commits into from
Sep 10, 2024
Merged

fix: static files mounting bug #1746

merged 3 commits into from
Sep 10, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Sep 10, 2024

tldr of bug is:

  • enable static file mounting, the website works fine (and API routes via the website work fine), but the RESTClient unit tests start failing with "Method Not Allowed", indicating that the request is getting hijacked by the static files mount
  • disable static file mounting (can even try just commenting it out), and the RESTClient unit tests pass again

To check if the website is working: memgpt server then localhost:8283 should spawn the SPA

To check if the RESTClient unit tests are working, run pytest -s -vvv tests/test_client.py::test_agent

@cpacker cpacker changed the title fix: fix: static files mounting bug Sep 10, 2024
@@ -58,29 +55,6 @@
OPENAI_API_PREFIX = "/openai"


class SmartStaticFilesMiddleware(BaseHTTPMiddleware):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note @4shub here's the cleanup

@@ -123,7 +95,7 @@ def create_application() -> "FastAPI":
app.include_router(setup_auth_router(server, interface, password), prefix=API_PREFIX)

# / static files
# mount_static_files(app)
mount_static_files(app)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line causes unit tests to fail, but without it we lose the SPA

@cpacker cpacker merged commit 0cc7447 into main Sep 10, 2024
12 checks passed
@cpacker cpacker deleted the squash-static-files-bug branch September 10, 2024 23:32
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
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 this pull request may close these issues.

1 participant