Help deploying to vercel

110 views
Skip to first unread message

ASAMOAH EMMANUEL

unread,
Jun 13, 2024, 12:31:59 PM (13 days ago) Jun 13
to django...@googlegroups.com




Hi, I'm trying to deploy my django app to vercel and this is the error I'm currently facing. Any help would be greatly appreciated.

This Serverless Function has crashed.
Your connection is working correctly.
Vercel is working correctly.
500: INTERNAL_SERVER_ERRORCode: `FUNCTION_INVOCATION_FAILED`ID: `cdg1::q7cxr-1718294528917-9fa86c2da026`

If you are a visitor, contact the website owner or try again later.

If you are the owner, learn how to fix the error and check the logs.
Here are the logs:


JUN 13 16:02:11.69
GET
500
wallet-6l6smpavk-jasonpython50s-projects.vercel.app
name
 
/favicon.ico
LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html [ERROR] Runtime.ImportModuleError: Unable to import module 'vc__handler__python': No module named 'allauth' Traceback (most recent call last):

--
I don't stop when I'm tired, I only stop when the job is done.

Augusto Domingos

unread,
Jun 13, 2024, 1:00:12 PM (13 days ago) Jun 13
to Django users

Looks there's a problem with your module "allauth", have you installed that in your Vercel environment?

Try to install that, certify that your vercel.json file have some rules to install your python requirements.txt

If have some another question, please, let me know, I will try to help you.

ASAMOAH EMMANUEL

unread,
Jun 13, 2024, 2:23:13 PM (13 days ago) Jun 13
to django...@googlegroups.com
requirements.txt

arrow==1.3.0
asgiref==3.8.1
binaryornot==0.4.4
certifi==2024.6.2
cffi==1.16.0
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
cookiecutter==2.6.0
crispy-tailwind==1.0.3
cryptography==42.0.7
defusedxml==0.7.1
Django==4.2.5
django-allauth
django-browser-reload==1.12.1
django-crispy-forms==2.1
django-tailwind
idna==3.7
install==1.3.5
Jinja2==3.1.4
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
oauthlib==3.2.2
pillow==10.2.0
psycopg2-binary==2.9.7
pycparser==2.22
pycryptodome==3.20.0
Pygments==2.18.0
PyJWT==2.8.0
python-dateutil==2.9.0.post0
python-decouple==3.8
python-slugify==8.0.4
python3-openid==3.2.0
PyYAML==6.0.1
rave-python==1.4.0
requests==2.32.3
requests-oauthlib==2.0.0
rich==13.7.1
six==1.16.0
sqlparse==0.5.0
text-unidecode==1.3
types-python-dateutil==2.9.0.20240316
tzdata==2024.1
urllib3==1.26.6
whitenoise==6.6.0


vercel.json

{
  "version": 2,
  "builds": [
    {
      "src": "inshala/wsgi.py",
      "use": "@vercel/python",
      "config": { "maxLambdaSize": "15mb", "runtime": "python3.9" }
    },
    {
      "src": "build_files.sh",
      "use": "@vercel/static-build",
      "config": {
        "distDir": "staticfiles"
      }
    }
  ],
  "routes": [
    {
      "src": "/static/(.*)",
      "dest": "/static/$1"
    },
    {
      "src": "/(.*)",
      "dest": "inshala/wsgi.py"
    }
  ]
}


build_file
# build_files.sh
pip install -r requirements.txt
python3.9 manage.py collectstatic --noinput
python3.9 manage.py migrate

wsgi.py
"""
WSGI config for inshala project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'inshala.settings')

app = get_wsgi_application()





Allauth is already installed on vercel.

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/041845f6-defc-41be-a996-d443a9341cebn%40googlegroups.com.

Augusto Domingos

unread,
Jun 14, 2024, 9:17:34 AM (12 days ago) Jun 14
to Django users

Hey, sorry for the late reply, I had just gone to bed at that time

Weird error...

Try specifying the version of django-allauth in your requirements file, then redeploy. Also, please check your Vercel logs carefully, or you can try to install the library in a package like this:  pip install django-allauth -t .  this can sometimes help with deploymnt issues by ensuring all dependencies are available in the project directory

If it still doesn't work, persists, it might be related to the Lambda function in Vercel, as it uses AWS infrastructure. In that case, you may need to investigate further or contact Vercel

Gabriel Soler

unread,
Jun 23, 2024, 4:24:42 PM (3 days ago) Jun 23
to Django users
Hi, I am curious how do you deploy on a function base system with Django, when you need to much to access the manage.py?
How do you deploy in vercel? Does it have a way to reach the command line?

Gabriel 

ASAMOAH EMMANUEL

unread,
Jun 23, 2024, 5:33:12 PM (3 days ago) Jun 23
to django...@googlegroups.com
No, you put all the management command you'll need in a build.sh file. so you can put say: python manage.py migrate and so on.

Reply all
Reply to author
Forward
0 new messages