Railway template deployment crashing

I created a deployment from my template and it crashes giving the following error[1]. I use the exact same code in one of my projects hosted on Railway and do not get this error. [1]
Traceback (most recent call last):
TypeError: unsupported operand type(s) for |: 'type' and 'type'
origin: discord.Message | discord.Interaction,
File "main.py", line 78, in AdvancedBot
class AdvancedBot(commands.Bot):
File "main.py", line 19, in <module>
Traceback (most recent call last):
TypeError: unsupported operand type(s) for |: 'type' and 'type'
origin: discord.Message | discord.Interaction,
File "main.py", line 78, in AdvancedBot
class AdvancedBot(commands.Bot):
File "main.py", line 19, in <module>
45 Replies
Percy
Percy2y ago
Project ID: d2917ff2-c65b-4779-ae0a-32a431678273
Adam
Adam2y ago
This is a code issue, not a Railway issue. We won’t be able to help you debug this
GetPsyched
GetPsychedOP2y ago
But I use the same syntax in my other project and it works fine. Besides, the bot runs on my local It's not that I'm pushing faulty code either
Brody
Brody2y ago
if you say the code is the exact same, well then you need to find the differences between this deployment that isn't working and the deployment that is working different node version? different typescript versions? different tsx version? etc. you've changed something between this and the deployment that did work.
LaCrak27
LaCrak272y ago
(its pyhton i think)
Brody
Brody2y ago
same difference same basic debugging techniques still apply though I don't know why I missed .py and throught it was typescript lmao
LaCrak27
LaCrak272y ago
i suggested a fix in her dm's, cuz iirc that operator is the same as the orkeyword (using words as operators feels wrong) but maybe that may work
Brody
Brody2y ago
cool python hard
GetPsyched
GetPsychedOP2y ago
Hmm, on second thought, I may have never pushed my new code (other project) to Railway The confusion was because that code is months old by now But I don't think I've pushed it to Railway in a whole year lol
Adam
Adam2y ago
python easy
GetPsyched
GetPsychedOP2y ago
This is probably a version issue?
Adam
Adam2y ago
Possibly? are your dependencies static?
GetPsyched
GetPsychedOP2y ago
I was told Railway uses 3.8 and supports up to 3.11 Yes. I have requirements.txt
Adam
Adam2y ago
Looks like whatever you’re comparing is invalid. Can you share your repo?
Adam
Adam2y ago
What is the highlighted line supposed to do? Never seen that origin: in python
GetPsyched
GetPsychedOP2y ago
It's a function parameter origin is an arbitrary name
Adam
Adam2y ago
Yeah I know that, I’ve never seen operators used in a parameter. Afaik that doesn’t work i’ve tried @Vin help
GetPsyched
GetPsychedOP2y ago
It was introduced in 3.10 AFAIK
Adam
Adam2y ago
ahhh gotcha. I tend to only use 3.9
GetPsyched
GetPsychedOP2y ago
That line is the same as: origin: typing.Union[discord.Message, discord.Interaction], This is the 3.9 equivalent^
Adam
Adam2y ago
got it. Makes sense now do you have a runtime.txt or railway file?
GetPsyched
GetPsychedOP2y ago
Nope
Adam
Adam2y ago
pretty sure railway defaults to python 3.9
GetPsyched
GetPsychedOP2y ago
I have a Dockerfile in my "other project" that I mentioned but it doesn't do anything special There must be a way to override that then?
Adam
Adam2y ago
best thing to do here is create your own dockerfile or use a nixpacks.toml to set your provider to python310
Brody
Brody2y ago
3.8
GetPsyched
GetPsychedOP2y ago
If I switch to direnv entirely, will that work as well 🤔 Context: direnv sets up all my project's requirements when cding into the dir
Brody
Brody2y ago
never heard of it, but sounds unnecessarily complex for use on railway
GetPsyched
GetPsychedOP2y ago
Well, it's for personal use mainly I will try this config.
Brody
Brody2y ago
just chuck 3.10 in a runtime.txt file
GetPsyched
GetPsychedOP2y ago
The entire contents of the txt will just be 3.10?
Brody
Brody2y ago
yes
GetPsyched
GetPsychedOP2y ago
Interesting
Brody
Brody2y ago
fun with regex
GetPsyched
GetPsychedOP2y ago
I guess a .python-version will be more pedagogical
Brody
Brody2y ago
your choice
GetPsyched
GetPsychedOP2y ago
Yes, changing the Python version worked.
MantisInABox
MantisInABox2y ago
Glad it got fixed.
GetPsyched
GetPsychedOP2y ago
Thanks guys!
Brody
Brody2y ago
remember when I said to try a different version of the language lol I got the language wrong, but same difference
GetPsyched
GetPsychedOP2y ago
Yeah, thanks a ton!
LaCrak27
LaCrak272y ago
nice!
Want results from more Discord servers?
Add your server