Skip to content

fix(firestore-vector-search): stop double-prefixing task queue names - #3118

Open
IzaakGough wants to merge 2 commits into
kitsfrom
fix/vector-search-task-queue-prefix
Open

fix(firestore-vector-search): stop double-prefixing task queue names#3118
IzaakGough wants to merge 2 commits into
kitsfrom
fix/vector-search-task-queue-prefix

Conversation

@IzaakGough

Copy link
Copy Markdown
Contributor

Same defect as #3113, in a second kit.

What was broken

The four queue names defaulted to kit-<instance id>-<function>, and the Admin SDK prepends that prefix again from FIREBASE_KIT_INSTANCE_ID in resolveResourceId(). The backfill and update triggers enqueued onto kit-<id>-kit-<id>-<function>, so a backfill or a configure-time update dispatched nothing.

What changed

resolveQueueNames() and the four *_QUEUE_NAME param defaults now use the bare export names. Those settings still work as overrides, but they name the deployed function rather than the fully-qualified queue. README and changelog say so.

How it was verified

tests/task-queues.test.ts points CLOUD_TASKS_EMULATOR_HOST at a local server and drives the real Admin SDK through handleBackfillTrigger, handleUpdateTrigger and handleInit, asserting the queue URLs. All three fail on the old code with the doubled prefix and pass on the new one. Two export-config tests pin the defaults and that an explicit override is kept verbatim.

Nothing covered the queue names before. Not exercised here: a live deploy.

The queue names defaulted to kit-<instance id>-<function>, and the Admin SDK
prepends that prefix again from FIREBASE_KIT_INSTANCE_ID, so the backfill and
update triggers enqueued onto kit-<id>-kit-<id>-<function> and failed with
"Queue does not exist". The four *_QUEUE_NAME settings now take the deployed
function name without the prefix.

The new test drives the real Admin SDK against a local Cloud Tasks emulator
host and asserts the URL it produces; nothing covered the queue names before.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an issue where backfill and update task dispatches failed with a "Queue does not exist" error due to double-prefixing of queue names. The queue names are updated to use the unprefixed deployed function names, and corresponding tests are added. Feedback on the new test file suggests checking if the Firebase app is already initialized before calling initializeApp and cleaning up modified environment variables in the afterAll hook to prevent test side effects.

Comment thread kits/firestore-vector-search/tests/task-queues.test.ts
Comment thread kits/firestore-vector-search/tests/task-queues.test.ts
…tial

Under the default credential the Admin SDK reaches for application default
credentials while building the task payload, so the test only passed on a
machine that had run `gcloud auth`. The emulator path never uses the
credential; it sends an "owner" token.
@IzaakGough
IzaakGough marked this pull request as ready for review September 4, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants