Skip to content

Native dev trigger /__void/queue returns 200 for a queue that no consumer handles #1060

Backlog

Description

@konaito

Describe the bug

In a native Void app, the dev trigger POST /__void/queue answers with status 200 when the queue in the body matches no consumer. The body is {"ok":false,"error":"No unambiguous queue handler matches \"<queue>\""} and the dev server logs the same error, but the status still says success, so a script or a curl -f that checks the status treats a typo in the queue name as a delivered batch.

The framework dev trigger (React Router, TanStack Start, vinext, Nuxt, Astro) answers this case with 404 and {"error":"No queue handler matches \"<queue>\""} (plugin-framework-triggers.ts). The native /__void/scheduled trigger answers an unknown cron with 404 since #1042.

Reproduction

On main (d89b033), in a native Void app with one consumer:

// queues/emails.ts
import { defineQueue } from 'void';

export default defineQueue(async (batch) => {
  console.log('emails consumer ran', batch.messages.length);
});

Start vp dev and send a queue name that no consumer handles, with the token the dev server prints:

curl -X POST http://localhost:5173/__void/queue \
  -H "x-void-dev-trigger: <printed-token>" \
  -d '{"queue":"emials","messages":[{"id":"1","timestamp":1,"body":{},"attempts":1}]}'
# {"ok":false,"error":"No unambiguous queue handler matches \"emials\""}  (status 200)

The dev server logs [void] No unambiguous queue handler matches "emials". The same request with "queue":"emails" returns {"ok":true} with 200 and runs the consumer.

Cause

__queueHandler in the route table generated by packages/void/src/router/compile.ts returns the result of __processQueue() with c.json(result), which is always 200. __processQueue() returns { ok: false, error } when no consumer matches.

Expected behavior

In the dev server, the native trigger answers an unknown queue with 404, like the framework one. Deployed Workers keep answering 200, since the platform's queue relay treats a 404 from /__void/queue as a legacy Worker and retries on /__queue.

I have a fix with a test and will open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions