hyperledger / indy-node-monitor

Apache License 2.0
13 stars 28 forks source link

Incompatility with latest fastapi/starlette packages versions #59

Closed pruneau628 closed 1 year ago

pruneau628 commented 1 year ago

As of probably last week (2023-03 11 to 18), building indy-node-monitor from scratch with non-cached build artefacts pulls fastapi==0.95.0, with requires starlette==0.26.1. This causes the indy-node-monitor process to crash on startup, with a bunch of stack trace containing the following kind of error:

  File "/home/indy/rest_api.py", line 80, in <module>
    async def network(network: Network = Path(example_network_enum, example=example_network_name, description="The network code."),
  File "/home/indy/.local/lib/python3.7/site-packages/fastapi/param_functions.py", line 42, in Path
    **extra,
  File "/home/indy/.local/lib/python3.7/site-packages/fastapi/params.py", line 83, in __init__
    assert default is ..., "Path parameters cannot have a default value"
AssertionError: Path parameters cannot have a default value
[2023-03-24 20:06:52 +0000] [11] [INFO] Worker exiting (pid: 11)

This is due to the fact that relying on creating fastapi Path object with code like:

Path(Network.sbn, example="sbn", description="The network code.")

was probably relying on a bug in the Path api, which was corrected since. The correct syntax is:

Path(path=Network.sbn, example="sbn", description="The network code.")

A PR to correct this problem is on its way.

WadeBarnes commented 1 year ago

Resolved via https://github.com/hyperledger/indy-node-monitor/pull/60