Skip to content

Single-ORCID Resync

Migrated from root technical docs.

Force a full publication + ORCID profile resync for a single researcher from the terminal.

Script: scripts/db/resync-orcid.mjs (relay) → cli/src/commands/resync/orcid.ts pnpm alias: pnpm resync:orcid -- <orcid-id> [flags]

Requires CLOUDFLARE_API_TOKEN (or CF_API_TOKEN) in .env at the repo root. Optional: SENTRY_DSN / GLITCHTIP_DSN to forward errors to GlitchTip.


  1. Discovers entity memberships — queries D1 across all 5 shards to find every active entity the researcher belongs to. Sends one ingestion job per entity.
  2. Resolves Cloudflare Queue IDs via the CF REST API.
  3. Per-entity: inserts a pre-flight ingestion_jobs row into D1 (required — the process worker drops messages with no matching row), then sends an IngestionJobMessage to worker-ingestion-queue.
  4. Sends a direct OrcidSyncJobMessage to worker-ingestion-orcid-sync-queue targeting just this ORCID (not a bulk scheduler).
  5. --watch mode — polls the D1 job rows every 3 s and prints live status until all jobs reach complete or failed (15-minute timeout).

Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --dry-run

Re-enrich all publications and sync the ORCID profile:

Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --watch

Force re-sync even if the ORCID record is unchanged

Section titled “Force re-sync even if the ORCID record is unchanged”
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --force
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --force --watch

Skip already-enriched publications (only queue new DOIs)

Section titled “Skip already-enriched publications (only queue new DOIs)”
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --skip-existing

Publication ingestion only (skip ORCID profile sync)

Section titled “Publication ingestion only (skip ORCID profile sync)”
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --ingestion-only

ORCID profile sync only (skip publication enrichment)

Section titled “ORCID profile sync only (skip publication enrichment)”
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --orcid-sync-only
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --entity-id cesam
Terminal window
pnpm resync:orcid -- 0000-0002-8685-5194 --local --dry-run

FlagDefaultDescription
--dry-runfalsePrint plan, do not send anything to queues
--forcefalseForce ORCID sync even if record is unchanged
--skip-existingfalseSkip DOIs already in D1 (default: re-enrich all)
--localfalseUse local D1 instead of --remote
--entity-id <id>auto-detectRestrict to a single entity
--ingestion-onlyfalseOnly queue publication ingestion, skip ORCID sync
--orcid-sync-onlyfalseOnly queue ORCID sync, skip ingestion
--watchfalsePoll ingestion job status until complete or failed

PipelineQueueWhat it does
Publication ingestionworker-ingestion-queueRe-fetches ORCID works → enriches via OpenAlex/Crossref → writes to publications
ORCID profile syncworker-ingestion-orcid-sync-queueFetches full ORCID record → writes to orcid_works, orcid_educations, orcid_employments, orcid_fundings

VariableRequiredDescription
CLOUDFLARE_API_TOKENYesCF token with Queues Edit permission. Also accepted as CF_API_TOKEN.
SENTRY_DSN / GLITCHTIP_DSNNoGlitchTip DSN — errors during dispatch are forwarded automatically.

  • resync.md — bulk resync for all researchers
  • cli/src/commands/resync/orcid.ts — implementation
  • scripts/db/resync-orcid.mjs — pnpm relay script