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
Percy14mo ago
Project ID: d2917ff2-c65b-4779-ae0a-32a431678273
Adam
Adam14mo ago
This is a code issue, not a Railway issue. We won’t be able to help you debug this
GetPsyched
GetPsyched14mo 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
Brody14mo 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
LaCrak2714mo ago
(its pyhton i think)
Brody
Brody14mo 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
LaCrak2714mo 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
Brody14mo ago
cool python hard
GetPsyched
GetPsyched14mo 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
Adam14mo ago
python easy
GetPsyched
GetPsyched14mo ago
This is probably a version issue?
Adam
Adam14mo ago
Possibly? are your dependencies static?
GetPsyched
GetPsyched14mo ago
I was told Railway uses 3.8 and supports up to 3.11 Yes. I have requirements.txt
Adam
Adam14mo ago
Looks like whatever you’re comparing is invalid. Can you share your repo?
Adam
Adam14mo ago
What is the highlighted line supposed to do? Never seen that origin: in python
GetPsyched
GetPsyched14mo ago
It's a function parameter origin is an arbitrary name
Adam
Adam14mo 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
GetPsyched14mo ago
It was introduced in 3.10 AFAIK
Adam
Adam14mo ago
ahhh gotcha. I tend to only use 3.9
GetPsyched
GetPsyched14mo ago
That line is the same as: origin: typing.Union[discord.Message, discord.Interaction], This is the 3.9 equivalent^
Adam
Adam14mo ago
got it. Makes sense now do you have a runtime.txt or railway file?
GetPsyched
GetPsyched14mo ago
Nope
Adam
Adam14mo ago
pretty sure railway defaults to python 3.9
GetPsyched
GetPsyched14mo 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
Adam14mo ago
best thing to do here is create your own dockerfile or use a nixpacks.toml to set your provider to python310
Brody
Brody14mo ago
3.8
GetPsyched
GetPsyched14mo 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
Brody14mo ago
never heard of it, but sounds unnecessarily complex for use on railway
GetPsyched
GetPsyched14mo ago
Well, it's for personal use mainly I will try this config.
Brody
Brody14mo ago
just chuck 3.10 in a runtime.txt file
GetPsyched
GetPsyched14mo ago
The entire contents of the txt will just be 3.10?
Brody
Brody14mo ago
yes
GetPsyched
GetPsyched14mo ago
Interesting
Brody
Brody14mo ago
fun with regex
GetPsyched
GetPsyched14mo ago
I guess a .python-version will be more pedagogical
Brody
Brody14mo ago
your choice
GetPsyched
GetPsyched14mo ago
Yes, changing the Python version worked.
MantisInABox
MantisInABox14mo ago
Glad it got fixed.
GetPsyched
GetPsyched14mo ago
Thanks guys!
Brody
Brody14mo ago
remember when I said to try a different version of the language lol I got the language wrong, but same difference
GetPsyched
GetPsyched13mo ago
Yeah, thanks a ton!
LaCrak27
LaCrak2713mo ago
nice!