Is there a guide on how to use Queus with sveltekit?
I have managed to get them working on my local machine but every build which I try to do on Vercel itself with queues in the sveltekit framework is failing.
Is there a guide on how to use Queus with sveltekit?
I have managed to get them working on my local machine but every build which I try to do on Vercel itself with queues in the sveltekit framework is failing.
I don’t think there’s a SvelteKit-specific Queues guide yet, but the important pieces should still map to SvelteKit server routes.
For push mode, I’d start with the smallest setup:
// src/routes/api/orders/+server.ts
import { json } from '@sveltejs/kit';
import { send } from '@vercel/queue';
export async function POST({ request }) {
const body = await request.json();
const { messageId } = await send('orders', body);
return json({ messageId });
}
// src/routes/api/queues/process-order/+server.ts
import { handleCallback } from '@vercel/queue';
export const POST = handleCallback(async (message, metadata) => {
console.log('processing queue message', metadata.messageId, message);
});
Then make sure the trigger in vercel.json points at the actual SvelteKit route file, not the Next.js example path:
{
"functions": {
"src/routes/api/queues/process-order/+server.ts": {
"experimentalTriggers": [
{ "type": "queue/v2beta", "topic": "orders" }
]
}
}
}
A common gotcha is copying the docs’ app/api/.../route.ts path into a SvelteKit project. That path is for Next.js, so Vercel will not attach the trigger to your SvelteKit consumer.
I’d also confirm these before debugging deeper:
pnpm i @vercel/queue @sveltejs/adapter-vercel
vercel link
vercel env pull
vercel dev
If the build still fails on Vercel, the most useful detail to share would be the first actual build error line plus your vercel.json and the consumer route path, with any secrets removed.