Failed to deploy!Invalid service name

Invalid service name
44 Replies
Percy
Percy16mo ago
Project ID: N/A
Brody
Brody16mo ago
service names have a character limit of 32, perhaps that's your issue? oh yeah that's 46 characters
tankypaladin
tankypaladin16mo ago
:S can I even change the repo name right now? Im not sure
Brody
Brody16mo ago
I'm sure you can, you can also just create a blank service and then connect your repo to it, then give the service a shorter name
tankypaladin
tankypaladin16mo ago
Hold on I never deployed a FastAPI repo here, my first time using anything Python related I found somewhere I gotta add this somewhere: uvicorn main:app --host 0.0.0.0 --port $PORT
Brody
Brody16mo ago
correct, you would use that, adjusting the main:app part incase your entrypoint isn't named main
tankypaladin
tankypaladin16mo ago
Oh I got this error on the logs: Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' (but it works 100% on local btw) okey so it seems I need to create a requirements.txt, with the modules to be installed, is this correct?
Brody
Brody16mo ago
you are correct again!
tankypaladin
tankypaladin16mo ago
okey, will try that @Brody Im not sure what Im doing wrong Yeah I keep getting this, no idea what could it be: ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi' Traceback (most recent call last): File "main.py", line 1, in <module> from fastapi import FastAPI ModuleNotFoundError: No module named 'fastapi'
Brody
Brody16mo ago
please no pings i will look at your repo shortly
tankypaladin
tankypaladin16mo ago
ah sorry for the pings okey thank you
Brody
Brody16mo ago
move the requirements.txt file into the app folder
tankypaladin
tankypaladin16mo ago
ah gonna try that right now
Brody
Brody16mo ago
I assume you have the root directory set to /app ?
tankypaladin
tankypaladin16mo ago
mmm actually yes I think so I got a huge long error, hold on
tankypaladin
tankypaladin16mo ago
tankypaladin
tankypaladin16mo ago
It somehow seems like it started doing the pip install requirements so at least Its showing that
tankypaladin
tankypaladin16mo ago
Hold I will copy the entire Build Logs:
Brody
Brody16mo ago
that's not the entire build logs
tankypaladin
tankypaladin16mo ago
I think discord recognised message as too long and cut it for me hold on I will put it into a .txt myself
tankypaladin
tankypaladin16mo ago
There it is I cant figure out the issue tbh
Brody
Brody16mo ago
it doesnt look like you are using mysqlclient anywhere, try removing it from your req.txt
tankypaladin
tankypaladin16mo ago
I will try that later im going to eat some food brb
Brody
Brody16mo ago
sounds good!
tankypaladin
tankypaladin16mo ago
Just did and commited, but it crashed again, Im not sure about the mysql client and Im actually using a mysqldb, so it might make sense. Im not even sure what dependencies I installed tbh
Brody
Brody16mo ago
you might wanna go through your requirements.txt and remove stuff you arent using
tankypaladin
tankypaladin16mo ago
Im not even sure where most those requirements are even coming from
Brody
Brody16mo ago
your system you froze all your system packages into that requirements.txt file
tankypaladin
tankypaladin16mo ago
ah I wonder if theres a way to automatically detect what modules are being used cause otherwise ima have to play guess since some of the modules are native I believe, some others are not... Im coming from JS development, where theres a package.json, feel kinda lost either way Im using lets say, all those modules, and in local is not giving me any issues so Im not sure if it could be that the issue
Brody
Brody16mo ago
thats python dependency management for you
tankypaladin
tankypaladin16mo ago
but it should not crash either way assuming it just has more packages, if its working on my local, right? I understand it will take bit more of disk space but its just a demo for my CV I dont plan to do much more there so in my opinion it would be okey if it had many many modules even if half or more unused Im using Python 3.11 in local, do you know the version of Railway? Or how to update it? Maybe it could be that
tankypaladin
tankypaladin16mo ago
ah, is it possible to update it?
Brody
Brody16mo ago
please read the docs i linked
tankypaladin
tankypaladin16mo ago
ah yes I see, with a .env I will try that now
Brody
Brody16mo ago
uh no?? where do you see mention of an .env file
tankypaladin
tankypaladin16mo ago
The version can be overridden by Setting the NIXPACKS_PYTHON_VERSION environment variable I just tried anyways and no it doesnt work :/ not sure what else to try anymore tbh
Brody
Brody16mo ago
move to postgres lol
tankypaladin
tankypaladin16mo ago
but my hosting is on mysql also it actually works, its a remote db like I can do post, get etc operations on the FastAPI backend running in local but the remote database gets updated I asked chatgpt for the dependencies after passing files by 1 and I got this: fastapi==0.100.0 passlib==1.7.4 PyJWT==2.7.0 pydantic==2.0.3 python-dotenv==1.0.0 SQLAlchemy==2.0.19 so im gonna try with that okey, build didnt crash now at least taking long to deploy now not sure if thats normal but lets see I got this different error now on the build logs: Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Traceback (most recent call last): File "/app/main.py", line 8, in <module> from .db.dbconnect import engine, Base, SessionLocal ImportError: attempted relative import with no known parent package Quick question: Railway might charge me usage over time for a proyect thats not deployed / crashed as it currently is?
Brody
Brody16mo ago
no you wouldnt be charged for services that dont have a running deployment
tankypaladin
tankypaladin16mo ago
ah okey, thanks
jonbeau
jonbeau16mo ago
Instead of pip freeze you could try pipreqs https://pypi.org/project/pipreqs/ (sorry if this is useless for you)
PyPI
pipreqs
Pip requirements.txt generator based on imports in project
tankypaladin
tankypaladin16mo ago
Thank you but anyways I will just not deploy that one its just for adding to CV that I have done the project they can see the code anyways should be enough for my purpose, hopefully
Want results from more Discord servers?
Add your server