Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug: `flet run --web` fails with `TypeError: ... unexpected keyword argument 'openapi_prefix'` on FastAPI 0.145+

Đã đóng Phù hợp với người mới
#6,984 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Một pull request liên quan đã được merge.

  • #6988 của @ndonkoHenri — đã merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
fastapi, python
Lĩnh vực
backend, web-dev

Hướng nghiên cứu

Bắt đầu với traceback tại flet_web/fastapi/flet_fastapi.py:117 và kiểm tra phiên bản dependency FastAPI được cài đặt bởi pip install 'flet[all]' trên Python 3.13. Lỗi được báo cáo là đối số openapi_prefix không mong đợi khi flet run --web tạo ứng dụng FastAPI; hãy xác nhận hành vi tương thích của dependency và tái hiện lỗi bằng ví dụ chat trên Debian 13 aarch64. Công việc hoàn tất khi ứng dụng khởi động và tải được trong trình duyệt trên cấu hình đã báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Duplicate Check
Describe the bug

I have a locally hosted Flet application on a raspberry pi running headless raspberry pi os, but when I run the application using flet run --web, I receive this error:

Traceback (most recent call last):
  File "/path/to/python/flet_apps/src/main.py", line 26, in <module>
    ft.run(main)
    ~~~~~~^^^^^^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 133, in run
    return asyncio.run(
           ~~~~~~~~~~~^
        run_async(
        ^^^^^^^^^^
    ...<11 lines>...
        )
        ^
    )
    ^
  File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 282, in run_async
    conn = await __run_web_server(
           ^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 627, in __run_web_server
    return await serve_fastapi_web_app(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
    )
    ^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/serve_fastapi_web_app.py", line 129, in serve_fastapi_web_app
    app = flet_web.fastapi.FastAPI(on_startup=[startup])
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/flet_fastapi.py", line 117, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        debug=debug,
        ^^^^^^^^^^^^
    ...<33 lines>...
        **extra,
        ^^^^^^^^
    )
    ^
TypeError: FastAPI.__init__() got an unexpected keyword argument 'openapi_prefix'
Code sample
Code

I used the given chat application example

To reproduce
  1. On a headless Linux system, create a folder and enter into it
  2. Create a Python virtual env, python -m venv .venv
  3. Activate the virtual env, source .venv/bin/activate
  4. Install flet, pip install 'flet[all]'
  5. Run flet create
  6. Copy the chat example and replace it with the contents of src/main.py
Expected behavior

Expect to see the app load in the browser

Screenshots / Videos
Captures Image Image
Operating System

Linux

Operating system details

Debian GNU/Linux 13 (trixie) aarch64

Flet version

1.0.4

Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

Suggestions

I suspect the reason the issue is arising is due to the fact that the web/ directory is missing in the .venv/lib/python3.13/site-packages/flet_web/ folder. Is the directory not present have to do with the fact that Raspberry Pi OS is running headless? My daily laptop does have that web/ directory present and flet run --web works fine.

Logs
Logs
Traceback (most recent call last):
  File "/path/to/python/flet_apps/src/main.py", line 26, in <module>
    ft.run(main)
    ~~~~~~^^^^^^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 133, in run
    return asyncio.run(
           ~~~~~~~~~~~^
        run_async(
        ^^^^^^^^^^
    ...<11 lines>...
        )
        ^
    )
    ^
  File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 282, in run_async
    conn = await __run_web_server(
           ^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 627, in __run_web_server
    return await serve_fastapi_web_app(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
    )
    ^
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/serve_fastapi_web_app.py", line 129, in serve_fastapi_web_app
    app = flet_web.fastapi.FastAPI(on_startup=[startup])
  File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/flet_fastapi.py", line 117, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        debug=debug,
        ^^^^^^^^^^^^
    ...<33 lines>...
        **extra,
        ^^^^^^^^
    )
    ^
TypeError: FastAPI.__init__() got an unexpected keyword argument 'openapi_prefix'
Additional details

No response

Ngôn ngữ chính
Python
Star
17.4k
Fork
728
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
54

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flet-dev/flet

Tất cả issue của flet-dev/flet

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.