R
Railway•14mo ago
Malay

non_field_errors: ["State could not be found in server-side session data."]

I have deployed my django rest framework app on Railway. I'm using djoser with social-auth-app-django. My app works on local host. But I'm getting above error when I make post request to /auth/o/google-oauth2/?state=''..."&code=''..." after getting state and code from google authorization url.
34 Replies
Percy
Percy•14mo ago
Project ID: 286dccfe-bf85-48fe-ae80-ab24c5a80716
Malay
MalayOP•14mo ago
286dccfe-bf85-48fe-ae80-ab24c5a80716 @Brody Can you please help me here?
Brody
Brody•14mo ago
please no pings #🛂|readme #5 I will need to see your deployment logs https://bookmarklets.up.railway.app/log-downloader/ and it would be very useful to see your repo as well
Malay
MalayOP•14mo ago
When i make a request to the server I don't see any change in logs in observability tab. I also tried railway logs CLI command there also I didn't see any cahnge in logs. Did I miss some thing in my django rest framework app??
Brody
Brody•14mo ago
it's possible, but some common things to first check would be - is railway using the same python version as you use locally - are you pinning your dependencies to the same version you have installed locally - have you forgotten to add some environment variables for google auth
Malay
MalayOP•14mo ago
didn't understand your second point. I'm using 3.10.11 in dev and the app is deployed using dockerfile and in dockerfile I have mentioned this "FROM python:3.10". So, I guess python version is not an issue. I have also checked the environments they are the same for prodution and local dev
Floris
Floris•14mo ago
when you have your packages that you install like
pip install django
pip install django
these install under a version and in your requirements.txt it's common practice to specify the version you had locally so you know that version was stable with your code
Malay
MalayOP•14mo ago
Okay. Let me try that
Floris
Floris•14mo ago
just do
pip freeze
pip freeze
and look for django and just literally copy that and have the == with the version behind
Malay
MalayOP•14mo ago
In production I'm using via requirements.txt file only
Malay
MalayOP•14mo ago
No description
Malay
MalayOP•14mo ago
How do I check if my python version in prod in rialway??
Floris
Floris•14mo ago
it will install these so if this works for you in local dev then the depends shouldnt be the issue
Malay
MalayOP•14mo ago
How can I see the deatiled log for django rest framewrk in railway?
Brody
Brody•14mo ago
do not do pip freeze unless you are using a venv, pip freeze will place all the dependencies installed on the computer into the requirements.txt file are there no logs in your deployment logs?
Floris
Floris•14mo ago
it does not ir just prints if you pass an extra xarg yes
Brody
Brody•14mo ago
I know it just prints, but if you redirect the output to the requirements.txt file then it will and that's hardly ever desirable
Malay
MalayOP•14mo ago
I'm using venv I'm sharing the loggs now
Brody
Brody•14mo ago
it's printed in the build table at the top of the build logs
Malay
MalayOP•14mo ago
in the build logs i see this line #3 [internal] load metadata for docker.io/library/python:3.10
Brody
Brody•14mo ago
you are using a dockerfile, this would have been very good information to know, please send the dockerfile
Malay
MalayOP•14mo ago
In venev I'm using Python 3.10.11 FROM python:3.10 ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 WORKDIR /app COPY . /app/ RUN python3 -m venv venv RUN . venv/bin/activate RUN apt-get update && apt-get install -y \ build-essential \ libpoppler-cpp-dev \ pkg-config \ python3-dev \ && apt-get clean RUN pip install --no-cache-dir -r requirements.txt CMD python manage.py migrate && gunicorn core.wsgi:application
Brody
Brody•14mo ago
do you build with this dockerfile locally
Malay
MalayOP•14mo ago
no locally I run the server inside venv
Brody
Brody•14mo ago
okay then at this point I am confident in saying that this is a code issue
Malay
MalayOP•14mo ago
But running server locally inside venv I don't get this error only In prod this happening in railway
Brody
Brody•14mo ago
unfortunately that doesn't rule out a code issue you build with a dockerfile, you have full control over how your app is built and ran, this isn't an issue with railway
Malay
MalayOP•14mo ago
ANy guess how can I solve this?
Brody
Brody•14mo ago
stackoverflow? these threads are generally not for code issues, and more for help with the platform
Malay
MalayOP•14mo ago
I understand. I tried stackover flow. no clear answer there.
Brody
Brody•14mo ago
this issue wouldn't be isolated to railway, please do further research
Malay
MalayOP•14mo ago
is there any way to see more detailed logs where exactly the error is happning. instead of just what we see in this ss.
No description
Brody
Brody•14mo ago
if you dont see detailed error logs then your code is simply not logging the errors make sure you log errors to stderr without buffering
Want results from more Discord servers?
Add your server