From 62b98afb3c6e68a6654e555c4c464cdab8ff66c2 Mon Sep 17 00:00:00 2001 From: heather Date: Thu, 23 Jul 2026 16:51:31 +0000 Subject: [PATCH] Report the package version in the SDK user agent The VERSION constant used for the WorkOS appInfo user-agent tag was hardcoded to '2.14.0' and never updated, so every release (through v4.3.0) reported authkit/nextjs: 2.14.0 in telemetry regardless of the installed version. Set it to the real version, annotate it for release-please so future releases bump it automatically, and add a test asserting it stays in sync with package.json. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- release-please-config.json | 3 ++- src/workos.spec.ts | 7 +++++++ src/workos.ts | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index 637e606..44074b0 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,7 +5,8 @@ ".": { "release-type": "node", "changelog-path": "CHANGELOG.md", - "versioning": "default" + "versioning": "default", + "extra-files": ["src/workos.ts"] } } } diff --git a/src/workos.spec.ts b/src/workos.spec.ts index da44f31..158b0cc 100644 --- a/src/workos.spec.ts +++ b/src/workos.spec.ts @@ -1,3 +1,4 @@ +import { readFileSync } from 'node:fs'; import { WorkOS } from '@workos-inc/node'; import { getWorkOS, VERSION } from './workos.js'; @@ -7,6 +8,12 @@ describe('workos', () => { vi.clearAllMocks(); }); + it('reports the package version in the user agent', () => { + const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')); + + expect(VERSION).toEqual(version); + }); + it('initializes WorkOS with the correct configuration', () => { // Extracting the config to avoid a circular dependency error const workosConfig = { diff --git a/src/workos.ts b/src/workos.ts index 104269a..064b072 100644 --- a/src/workos.ts +++ b/src/workos.ts @@ -2,7 +2,7 @@ import { WorkOS } from '@workos-inc/node'; import { WORKOS_API_HOSTNAME, WORKOS_API_KEY, WORKOS_API_HTTPS, WORKOS_API_PORT } from './env-variables.js'; import { lazy } from './utils.js'; -export const VERSION = '2.14.0'; +export const VERSION = '4.3.0'; // x-release-please-version const options = { apiHostname: WORKOS_API_HOSTNAME,