Failing to load catalog on startup using FastAPI lifespan #221
Unanswered
ancientpi3
asked this question in
Q&A
Replies: 2 comments
-
Hi @ancientpi3 you could write a custom version of this middleware https://github.com/developmentseed/tipg/blob/main/tipg/middleware.py#L73-L118 ☝ will raise an issue if the catalog doesn't exist, yours could just run the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks Vincent, we'll give this solution a shot! It's not an urgent bug or anything. We mostly just wanted to call out that the implementation provided in the TiPG documentation fails for our case. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
We are encountering an issue when trying to handle start up and shut down using a FastAPI lifespan function implementation which we based off an example in your documentation (linked below). It appears that
connect_to_db()
andregister_collection_catalog()
will fail quietly on startup. We suspect it is because our Postgres instance isn't yet ready when these functions are being called on startup.Calling the
/collections
endpoint immediately after startup returns:{"detail":"Could not find collections catalog."}
If we manually trigger the
/register
endpoint afterward, the collections load correctly.Your example implementation:
https://developmentseed.org/tipg/advanced/customization/
Our implementation:
https://github.com/SkyTruth/cerulean-cloud/blob/5caa95482e261209ae4ee31d68a111322c112c21/cerulean_cloud/cloud_run_tipg/handler.py
Do you have any recommended changes for getting startup to work using FastAPI lifespan functions?
Beta Was this translation helpful? Give feedback.
All reactions