php icon indicating copy to clipboard operation
php copied to clipboard

Cronjob support?

Open nadar opened this issue 8 months ago • 1 comments

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": "[email protected]"
        }
    },
    "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?

nadar avatar Jan 31 '25 08:01 nadar