Deploying django in vercel function timeout

i have a function called FetchAjaxs, which works fine in my local machine but not when i deploy

view.py

FetchAjaxs:
 #makes a api call to a different url which then returns a json to display in webpage

i am calling that function from a ajaxs in my html

index.html

$.ajax({
                    url: "{% url 'FetchAjaxs' %}", // Django URL for the view
                    type: "POST",
                    data: $(this).serialize(), // Serialize form data
                    headers: {
                        "X-CSRFToken": "{{ csrf_token }}" // Add CSRF token for security
                    },
                    dataType: 'json',

my url.py looks like this

path('fetch-ajax/', FetchAjaxs, name='FetchAjaxs'), 

and my vercel.json looks like this

{
    "builds": [{
        "src": "AppName/wsgi.py",
        "use": "@vercel/python",
        "config": { "maxLambdaSize": "15mb", "runtime": "python3.9", "maxDuration": 300}


    }

    ],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "AppName/wsgi.py"
        }
    ]
}

when i run this in my local machine it works but when i run it in vercel it doesnt i figured it has to do with time out

this is the error i get in my xhr

{"error": {"code": "504", "message": "An error occurred with your deployment"}}

i have increased the timeout in the settings in vercel vercel function timeout

however i still get the same error, any help would be appreciated , also please note i am very new to vercel.

Вернуться на верх