You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Behavior
I am able to add both cron jobs and enqueue other task. However when they are processed nothing is logged to the console and no external domains are contacted.
I am using SvleteKit btw
Input Code
REPL or Repo link if applicable:
import{Queue}from"quirrel/sveltekit";exportconstalertsQueue=Queue("/alerts-queue",// 👈 the route it's reachable onasync(name)=>{console.log(`Greetings, ${name}!`);try{constresponse=awaitfetch('https://rb.gy/y8avpb',{method: 'GET',headers: {'Content-Type': 'application/json'}});if(!response.ok){// Handle errors here (e.g., throw an error or log the issue)thrownewError(`Error posting data: ${response.statusText}`);}console.log('Data posted successfully!');}catch(error){console.error('Error posting data:',error);}});exportconstenqueueAlert=async(request)=>{consturl=newURL(request.url);constsearchParams=url.searchParams;constname=searchParams.get('name');console.log(`Enqueuing alert for ${name}`);awaitalertsQueue.enqueue(name,{delay: "3s",});return"ok";}exportconstcronHandler=async()=>{console.log('Running cron job');letdata={name: "John Doe"};try{constresponse=awaitfetch('https://rb.gy/y8avpb',{method: 'GET',headers: {'Content-Type': 'application/json'}});if(!response.ok){// Handle errors here (e.g., throw an error or log the issue)thrownewError(`Error posting data: ${response.statusText}`);}console.log('Data posted successfully!');}catch(error){console.error('Error posting data:',error);}};exportdefaultalertsQueue;
The above exports are imported to the +server.js file here:
import{CronJob}from"quirrel/next";import{alertsQueue,enqueueAlert,cronHandler}from"./queues.js";constalertCron=CronJob("/alerts-queue",// the route that it's reachable on["* * * * *","America/Chicago"],// every day at 2AM, in Berlin time. you can also write @weekly or @daily!cronHandler);exportconstPOST=alertsQueue;exportconstGET=async(request)=>{// Call the appropriate function based on the requestconstresult=awaitenqueueAlert(request);returnnewResponse(result,{status: 200})}
Expected behavior/code
I would expect that the handler would be executed on schedule, the data logged out to the console, and the external link fetched.
Bug Report
Current Behavior
I am able to add both cron jobs and enqueue other task. However when they are processed nothing is logged to the console and no external domains are contacted.
I am using SvleteKit btw
Input Code
The above exports are imported to the +server.js file here:
Expected behavior/code
I would expect that the handler would be executed on schedule, the data logged out to the console, and the external link fetched.
Environment
{
"name": "prg",
"version": "0.0.1",
"scripts": {
"dev": "concurrently 'vite dev' 'quirrel'",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint ."
},
"devDependencies": {
"@fontsource/fira-mono": "^4.5.10",
"@neoconfetti/svelte": "^1.0.0",
"@prisma/client": "^4.11.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "8.56.0",
"eslint": "^8.56.0",
"eslint-plugin-svelte": "^2.35.1",
"prisma": "^4.11.0",
"svelte": "^4.2.7",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"quirrel": "^1.14.1"
}
}
The text was updated successfully, but these errors were encountered: