Skip to content

Cronjob support? #578

@nadar

Description

@nadar

Hi everyone

Does cronjobs work with the php runtime? I tested a few things, but it seems not to work. Can anyone confirm this or is there a workaround?

I use laravel 11 (the webproject itself works perfectly) with the following vercel.json

{
    "version": 2,
    "regions": [
        "fra1"
    ],
    "functions": {
        "api/index.php": {
            "runtime": "vercel-php@0.7.3"
        }
    },
    "routes": [
        {
            "src": "/build/(.*)",
            "dest": "/build/$1"
        },
        {
            "src": "/(.*\\.(?:css|js|png|jpg|jpeg|gif|svg|ico|ttf|woff|woff2|eot|otf|webp|avif|txt|webmanifest))$",
            "dest": "/public/$1"
        },
        {
            "src": "/(.*)",
            "dest": "/api/index.php"
        }
    ],
    "outputDirectory": "public",
    "crons": [
        {
            "path": "/api/cron",
            "schedule": "*/5 * * * *"
        }
    ]
}

i have registered a route in routes/web.php like Route::get('/cron', function () {...} and i tested with

"crons": [
        {
            "path": "/cron",
            "schedule": "*/5 * * * *"
        }
    ]

and

"crons": [
        {
            "path": "/api/cron",
            "schedule": "*/5 * * * *"
        }
    ]

but both seems not to work, i think its because of the none official runtime?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions