6 months ago
HI, I am trying to deploy a FastAPI backend with Modal and Posgres SQL on Railway.com. Every time I make a connection to modal functions using modal_function.spawn(). I get this error: ValueError: Modal connection failed: Function has not been hydrated with the metadata it needs to run on Modal. I also noticed on my Modal dashboard that they api token were never used. I added the Model_token_id and model_token_secret to Railway but it seems not using it.
5 Replies
6 months ago
Hi!
You mentioned using MODEL_TOKEN_ID and MODEL_TOKEN_SECRET, make sure you are using the right naming (case-sensitive).
Correct environment variable names for Modal:
MODAL_TOKEN_IDMODAL_TOKEN_SECRET
6 months ago
Thank you for the response. I wrote them wrong here, but I did use MODAL_TOKEN_ID & MODAL_TOKEN_SECRET.
What else could cause this? I have a config.py file too.
6 months ago
The most likely issue is the environment variable naming. Modal expects the exact names MODAL_TOKEN_ID and MODAL_TOKEN_SECRET. Double-check these in your Railway dashboard and make sure there are no typos or case differences. Can you share how you're currently initializing Modal in your FastAPI code?
fuve
The most likely issue is the environment variable naming. Modal expects the exact names MODAL_TOKEN_ID and MODAL_TOKEN_SECRET. Double-check these in your Railway dashboard and make sure there are no typos or case differences. Can you share how you're currently initializing Modal in your FastAPI code?
6 months ago
Hi, please read the feed before you comment the exact same answer.
6 months ago
Hi,
can you show your config.py please? Maybe there are some mistakes.
Is it working on your machine?