Exporting environment variables Exporting CI Exporting DISPLAY Exporting NODE_ENV Exporting PAGER Exporting SEMAPHORE Exporting SEMAPHORE_AGENT_MACHINE_ENVIRONMENT_TYPE Exporting SEMAPHORE_AGENT_MACHINE_OS_IMAGE Exporting SEMAPHORE_AGENT_MACHINE_TYPE Exporting SEMAPHORE_ARTIFACT_TOKEN Exporting SEMAPHORE_CACHE_BACKEND Exporting SEMAPHORE_CACHE_PRIVATE_KEY_PATH Exporting SEMAPHORE_CACHE_URL Exporting SEMAPHORE_CACHE_USERNAME Exporting SEMAPHORE_GIT_BRANCH Exporting SEMAPHORE_GIT_COMMITTER Exporting SEMAPHORE_GIT_COMMIT_AUTHOR Exporting SEMAPHORE_GIT_COMMIT_RANGE Exporting SEMAPHORE_GIT_DIR Exporting SEMAPHORE_GIT_PROVIDER Exporting SEMAPHORE_GIT_PR_BRANCH Exporting SEMAPHORE_GIT_PR_NAME Exporting SEMAPHORE_GIT_PR_NUMBER Exporting SEMAPHORE_GIT_PR_SHA Exporting SEMAPHORE_GIT_PR_SLUG Exporting SEMAPHORE_GIT_REF Exporting SEMAPHORE_GIT_REF_TYPE Exporting SEMAPHORE_GIT_REPO_NAME Exporting SEMAPHORE_GIT_REPO_SLUG Exporting SEMAPHORE_GIT_SHA Exporting SEMAPHORE_GIT_URL Exporting SEMAPHORE_GIT_WORKING_BRANCH Exporting SEMAPHORE_JOB_CREATION_TIME Exporting SEMAPHORE_JOB_ID Exporting SEMAPHORE_JOB_NAME Exporting SEMAPHORE_ORGANIZATION_URL Exporting SEMAPHORE_PIPELINE_0_ARTEFACT_ID Exporting SEMAPHORE_PIPELINE_ARTEFACT_ID Exporting SEMAPHORE_PIPELINE_ID Exporting SEMAPHORE_PIPELINE_PROMOTED_BY Exporting SEMAPHORE_PIPELINE_PROMOTION Exporting SEMAPHORE_PIPELINE_RERUN Exporting SEMAPHORE_PROJECT_ID Exporting SEMAPHORE_PROJECT_NAME Exporting SEMAPHORE_TOOLBOX_METRICS_ENABLED Exporting SEMAPHORE_WORKFLOW_HOOK_SOURCE Exporting SEMAPHORE_WORKFLOW_ID Exporting SEMAPHORE_WORKFLOW_NUMBER Exporting SEMAPHORE_WORKFLOW_RERUN Exporting SEMAPHORE_WORKFLOW_TRIGGERED_BY Exporting SEMAPHORE_WORKFLOW_TRIGGERED_BY_API Exporting SEMAPHORE_WORKFLOW_TRIGGERED_BY_HOOK Exporting SEMAPHORE_WORKFLOW_TRIGGERED_BY_MANUAL_RUN Exporting SEMAPHORE_WORKFLOW_TRIGGERED_BY_SCHEDULE Exporting SSH_PRIVATE_KEY_PATH Exporting TERM Injecting Files Injecting /home/semaphore/.ssh/semaphore_cache_key with file mode 0600 Injecting /home/semaphore/.ssh/id_rsa with file mode 0600 Running the pre-job hook configured in the agent Running: source /opt/semaphoreci/prejob/pre_job.sh Warning: The agent is configured to fail the job if the pre-job hook fails. Installing toolbox in pre-job-hook Toolbox download URL: http://packages.semaphoreci.com/toolbox/releases/download/v1.21.8/linux.tar Tar file: linux.tar Attempt 5 toolbox/ toolbox/sem-service toolbox/install-package toolbox/toolbox toolbox/libcheckout toolbox/test-results toolbox/artifact toolbox/install-toolbox toolbox/spc toolbox/cache toolbox/sem-service-check-params toolbox/sem-semantic-release toolbox/sem-version toolbox/ssh-session-cli toolbox/sem-install toolbox/libchecksum toolbox/retry toolbox/sem-context toolbox/Dockerfile.dev toolbox/sem-dockerize toolbox/when toolbox/enetwork toolbox/system-metrics-collector toolbox/README.md retry installed ssh-session-cli installed cache installed sem-context installed sem-service installed sem-dockerize installed sem-service-check-params installed sem-semantic-release installed Installing the artifacts CLI artifacts installed Installing the test results CLI test-results installed Installing the install-package for linux install-package installed Installing the SPC CLI spc installed Installing the when CLI when installed Installing the enetwork CLI enetwork installed Starting to collect System Metrics in /tmp/system-metrics Starting virtual X frame buffer: Xvfb. Toolbox installed Starting ssh-agent Agent pid 3664 ssh-agent started Connecting to cache # 116.202.32.43:29920 SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 # 116.202.32.43:29920 SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 # 116.202.32.43:29920 SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 # 116.202.32.43:29920 SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 # 116.202.32.43:29920 SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 Identity added: /home/semaphore/.ssh/semaphore_cache_key (/home/semaphore/.ssh/semaphore_cache_key) checkout Cloning into 'workos-node'... Warning: Permanently added 'github.com' (ED25519) to the list of known hosts. remote: Enumerating objects: 711, done. remote: Counting objects: 0% (1/711) remote: Counting objects: 1% (8/711) remote: Counting objects: 2% (15/711) remote: Counting objects: 3% (22/711) remote: Counting objects: 4% (29/711) remote: Counting objects: 5% (36/711) remote: Counting objects: 6% (43/711) remote: Counting objects: 7% (50/711) remote: Counting objects: 8% (57/711) remote: Counting objects: 9% (64/711) remote: Counting objects: 10% (72/711) remote: Counting objects: 11% (79/711) remote: Counting objects: 12% (86/711) remote: Counting objects: 13% (93/711) remote: Counting objects: 14% (100/711) remote: Counting objects: 15% (107/711) remote: Counting objects: 16% (114/711) remote: Counting objects: 17% (121/711) remote: Counting objects: 18% (128/711) remote: Counting objects: 19% (136/711) remote: Counting objects: 20% (143/711) remote: Counting objects: 21% (150/711) remote: Counting objects: 22% (157/711) remote: Counting objects: 23% (164/711) remote: Counting objects: 24% (171/711) remote: Counting objects: 25% (178/711) remote: Counting objects: 26% (185/711) remote: Counting objects: 27% (192/711) remote: Counting objects: 28% (200/711) remote: Counting objects: 29% (207/711) remote: Counting objects: 30% (214/711) remote: Counting objects: 31% (221/711) remote: Counting objects: 32% (228/711) remote: Counting objects: 33% (235/711) remote: Counting objects: 34% (242/711) remote: Counting objects: 35% (249/711) remote: Counting objects: 36% (256/711) remote: Counting objects: 37% (264/711) remote: Counting objects: 38% (271/711) remote: Counting objects: 39% (278/711) remote: Counting objects: 40% (285/711) remote: Counting objects: 41% (292/711) remote: Counting objects: 42% (299/711) remote: Counting objects: 43% (306/711) remote: Counting objects: 44% (313/711) remote: Counting objects: 45% (320/711) remote: Counting objects: 46% (328/711) remote: Counting objects: 47% (335/711) remote: Counting objects: 48% (342/711) remote: Counting objects: 49% (349/711) remote: Counting objects: 50% (356/711) remote: Counting objects: 51% (363/711) remote: Counting objects: 52% (370/711) remote: Counting objects: 53% (377/711) remote: Counting objects: 54% (384/711) remote: Counting objects: 55% (392/711) remote: Counting objects: 56% (399/711) remote: Counting objects: 57% (406/711) remote: Counting objects: 58% (413/711) remote: Counting objects: 59% (420/711) remote: Counting objects: 60% (427/711) remote: Counting objects: 61% (434/711) remote: Counting objects: 62% (441/711) remote: Counting objects: 63% (448/711) remote: Counting objects: 64% (456/711) remote: Counting objects: 65% (463/711) remote: Counting objects: 66% (470/711) remote: Counting objects: 67% (477/711) remote: Counting objects: 68% (484/711) remote: Counting objects: 69% (491/711) remote: Counting objects: 70% (498/711) remote: Counting objects: 71% (505/711) remote: Counting objects: 72% (512/711) remote: Counting objects: 73% (520/711) remote: Counting objects: 74% (527/711) remote: Counting objects: 75% (534/711) remote: Counting objects: 76% (541/711) remote: Counting objects: 77% (548/711) remote: Counting objects: 78% (555/711) remote: Counting objects: 79% (562/711) remote: Counting objects: 80% (569/711) remote: Counting objects: 81% (576/711) remote: Counting objects: 82% (584/711) remote: Counting objects: 83% (591/711) remote: Counting objects: 84% (598/711) remote: Counting objects: 85% (605/711) remote: Counting objects: 86% (612/711) remote: Counting objects: 87% (619/711) remote: Counting objects: 88% (626/711) remote: Counting objects: 89% (633/711) remote: Counting objects: 90% (640/711) remote: Counting objects: 91% (648/711) remote: Counting objects: 92% (655/711) remote: Counting objects: 93% (662/711) remote: Counting objects: 94% (669/711) remote: Counting objects: 95% (676/711) remote: Counting objects: 96% (683/711) remote: Counting objects: 97% (690/711) remote: Counting objects: 98% (697/711) remote: Counting objects: 99% (704/711) remote: Counting objects: 100% (711/711) remote: Counting objects: 100% (711/711), done. remote: Compressing objects: 0% (1/454) remote: Compressing objects: 1% (5/454) remote: Compressing objects: 2% (10/454) remote: Compressing objects: 3% (14/454) remote: Compressing objects: 4% (19/454) remote: Compressing objects: 5% (23/454) remote: Compressing objects: 6% (28/454) remote: Compressing objects: 7% (32/454) remote: Compressing objects: 8% (37/454) remote: Compressing objects: 9% (41/454) remote: Compressing objects: 10% (46/454) remote: Compressing objects: 11% (50/454) remote: Compressing objects: 12% (55/454) remote: Compressing objects: 13% (60/454) remote: Compressing objects: 14% (64/454) remote: Compressing objects: 15% (69/454) remote: Compressing objects: 16% (73/454) remote: Compressing objects: 17% (78/454) remote: Compressing objects: 18% (82/454) remote: Compressing objects: 19% (87/454) remote: Compressing objects: 20% (91/454) remote: Compressing objects: 21% (96/454) remote: Compressing objects: 22% (100/454) remote: Compressing objects: 23% (105/454) remote: Compressing objects: 24% (109/454) remote: Compressing objects: 25% (114/454) remote: Compressing objects: 26% (119/454) remote: Compressing objects: 27% (123/454) remote: Compressing objects: 28% (128/454) remote: Compressing objects: 29% (132/454) remote: Compressing objects: 30% (137/454) remote: Compressing objects: 31% (141/454) remote: Compressing objects: 32% (146/454) remote: Compressing objects: 33% (150/454) remote: Compressing objects: 34% (155/454) remote: Compressing objects: 35% (159/454) remote: Compressing objects: 36% (164/454) remote: Compressing objects: 37% (168/454) remote: Compressing objects: 38% (173/454) remote: Compressing objects: 39% (178/454) remote: Compressing objects: 40% (182/454) remote: Compressing objects: 41% (187/454) remote: Compressing objects: 42% (191/454) remote: Compressing objects: 43% (196/454) remote: Compressing objects: 44% (200/454) remote: Compressing objects: 45% (205/454) remote: Compressing objects: 46% (209/454) remote: Compressing objects: 47% (214/454) remote: Compressing objects: 48% (218/454) remote: Compressing objects: 49% (223/454) remote: Compressing objects: 50% (227/454) remote: Compressing objects: 51% (232/454) remote: Compressing objects: 52% (237/454) remote: Compressing objects: 53% (241/454) remote: Compressing objects: 54% (246/454) remote: Compressing objects: 55% (250/454) remote: Compressing objects: 56% (255/454) remote: Compressing objects: 57% (259/454) remote: Compressing objects: 58% (264/454) remote: Compressing objects: 59% (268/454) remote: Compressing objects: 60% (273/454) remote: Compressing objects: 61% (277/454) remote: Compressing objects: 62% (282/454) remote: Compressing objects: 63% (287/454) remote: Compressing objects: 64% (291/454) remote: Compressing objects: 65% (296/454) remote: Compressing objects: 66% (300/454) remote: Compressing objects: 67% (305/454) remote: Compressing objects: 68% (309/454) remote: Compressing objects: 69% (314/454) remote: Compressing objects: 70% (318/454) remote: Compressing objects: 71% (323/454) remote: Compressing objects: 72% (327/454) remote: Compressing objects: 73% (332/454) remote: Compressing objects: 74% (336/454) remote: Compressing objects: 75% (341/454) remote: Compressing objects: 76% (346/454) remote: Compressing objects: 77% (350/454) remote: Compressing objects: 78% (355/454) remote: Compressing objects: 79% (359/454) remote: Compressing objects: 80% (364/454) remote: Compressing objects: 81% (368/454) remote: Compressing objects: 82% (373/454) remote: Compressing objects: 83% (377/454) remote: Compressing objects: 84% (382/454) remote: Compressing objects: 85% (386/454) remote: Compressing objects: 86% (391/454) remote: Compressing objects: 87% (395/454) remote: Compressing objects: 88% (400/454) remote: Compressing objects: 89% (405/454) remote: Compressing objects: 90% (409/454) remote: Compressing objects: 91% (414/454) remote: Compressing objects: 92% (418/454) remote: Compressing objects: 93% (423/454) remote: Compressing objects: 94% (427/454) remote: Compressing objects: 95% (432/454) remote: Compressing objects: 96% (436/454) remote: Compressing objects: 97% (441/454) remote: Compressing objects: 98% (445/454) remote: Compressing objects: 99% (450/454) remote: Compressing objects: 100% (454/454) remote: Compressing objects: 100% (454/454), done. Receiving objects: 0% (1/711) Receiving objects: 1% (8/711) Receiving objects: 2% (15/711) Receiving objects: 3% (22/711) Receiving objects: 4% (29/711) Receiving objects: 5% (36/711) Receiving objects: 6% (43/711) Receiving objects: 7% (50/711) Receiving objects: 8% (57/711) Receiving objects: 9% (64/711) Receiving objects: 10% (72/711) Receiving objects: 11% (79/711) Receiving objects: 12% (86/711) Receiving objects: 13% (93/711) Receiving objects: 14% (100/711) Receiving objects: 15% (107/711) Receiving objects: 16% (114/711) Receiving objects: 17% (121/711) Receiving objects: 18% (128/711) Receiving objects: 19% (136/711) Receiving objects: 20% (143/711) Receiving objects: 21% (150/711) Receiving objects: 22% (157/711) Receiving objects: 23% (164/711) Receiving objects: 24% (171/711) Receiving objects: 25% (178/711) Receiving objects: 26% (185/711) Receiving objects: 27% (192/711) Receiving objects: 28% (200/711) Receiving objects: 29% (207/711) Receiving objects: 30% (214/711) Receiving objects: 31% (221/711) Receiving objects: 32% (228/711) Receiving objects: 33% (235/711) Receiving objects: 34% (242/711) Receiving objects: 35% (249/711) Receiving objects: 36% (256/711) Receiving objects: 37% (264/711) Receiving objects: 38% (271/711) Receiving objects: 39% (278/711) Receiving objects: 40% (285/711) Receiving objects: 41% (292/711) Receiving objects: 42% (299/711) Receiving objects: 43% (306/711) Receiving objects: 44% (313/711) Receiving objects: 45% (320/711) Receiving objects: 46% (328/711) Receiving objects: 47% (335/711) Receiving objects: 48% (342/711) Receiving objects: 49% (349/711) Receiving objects: 50% (356/711) Receiving objects: 51% (363/711) Receiving objects: 52% (370/711) Receiving objects: 53% (377/711) Receiving objects: 54% (384/711) Receiving objects: 55% (392/711) Receiving objects: 56% (399/711) Receiving objects: 57% (406/711) Receiving objects: 58% (413/711) Receiving objects: 59% (420/711) Receiving objects: 60% (427/711) Receiving objects: 61% (434/711) Receiving objects: 62% (441/711) Receiving objects: 63% (448/711) Receiving objects: 64% (456/711) Receiving objects: 65% (463/711) Receiving objects: 66% (470/711) Receiving objects: 67% (477/711) Receiving objects: 68% (484/711) Receiving objects: 69% (491/711) Receiving objects: 70% (498/711) Receiving objects: 71% (505/711) Receiving objects: 72% (512/711) Receiving objects: 73% (520/711) Receiving objects: 74% (527/711) Receiving objects: 75% (534/711) Receiving objects: 76% (541/711) Receiving objects: 77% (548/711) Receiving objects: 78% (555/711) Receiving objects: 79% (562/711) Receiving objects: 80% (569/711) Receiving objects: 81% (576/711) Receiving objects: 82% (584/711) remote: Total 711 (delta 368), reused 471 (delta 226), pack-reused 0 Receiving objects: 83% (591/711) Receiving objects: 84% (598/711) Receiving objects: 85% (605/711) Receiving objects: 86% (612/711) Receiving objects: 87% (619/711) Receiving objects: 88% (626/711) Receiving objects: 89% (633/711) Receiving objects: 90% (640/711) Receiving objects: 91% (648/711) Receiving objects: 92% (655/711) Receiving objects: 93% (662/711) Receiving objects: 94% (669/711) Receiving objects: 95% (676/711) Receiving objects: 96% (683/711) Receiving objects: 97% (690/711) Receiving objects: 98% (697/711) Receiving objects: 99% (704/711) Receiving objects: 100% (711/711) Receiving objects: 100% (711/711), 204.00 KiB | 1.10 MiB/s, done. Resolving deltas: 0% (0/368) Resolving deltas: 1% (4/368) Resolving deltas: 2% (8/368) Resolving deltas: 3% (12/368) Resolving deltas: 4% (15/368) Resolving deltas: 5% (19/368) Resolving deltas: 6% (23/368) Resolving deltas: 7% (26/368) Resolving deltas: 8% (30/368) Resolving deltas: 9% (34/368) Resolving deltas: 10% (37/368) Resolving deltas: 11% (41/368) Resolving deltas: 12% (45/368) Resolving deltas: 13% (48/368) Resolving deltas: 14% (52/368) Resolving deltas: 15% (56/368) Resolving deltas: 16% (59/368) Resolving deltas: 17% (63/368) Resolving deltas: 18% (67/368) Resolving deltas: 19% (70/368) Resolving deltas: 20% (74/368) Resolving deltas: 21% (78/368) Resolving deltas: 22% (81/368) Resolving deltas: 23% (85/368) Resolving deltas: 24% (89/368) Resolving deltas: 25% (92/368) Resolving deltas: 26% (96/368) Resolving deltas: 27% (100/368) Resolving deltas: 28% (104/368) Resolving deltas: 29% (107/368) Resolving deltas: 30% (111/368) Resolving deltas: 31% (115/368) Resolving deltas: 32% (118/368) Resolving deltas: 33% (122/368) Resolving deltas: 34% (126/368) Resolving deltas: 35% (129/368) Resolving deltas: 36% (133/368) Resolving deltas: 37% (137/368) Resolving deltas: 38% (140/368) Resolving deltas: 39% (144/368) Resolving deltas: 40% (148/368) Resolving deltas: 41% (151/368) Resolving deltas: 42% (155/368) Resolving deltas: 43% (159/368) Resolving deltas: 44% (162/368) Resolving deltas: 45% (166/368) Resolving deltas: 46% (170/368) Resolving deltas: 47% (173/368) Resolving deltas: 48% (177/368) Resolving deltas: 49% (181/368) Resolving deltas: 50% (184/368) Resolving deltas: 51% (188/368) Resolving deltas: 52% (192/368) Resolving deltas: 53% (196/368) Resolving deltas: 54% (199/368) Resolving deltas: 55% (203/368) Resolving deltas: 56% (207/368) Resolving deltas: 57% (210/368) Resolving deltas: 58% (214/368) Resolving deltas: 59% (218/368) Resolving deltas: 60% (221/368) Resolving deltas: 61% (225/368) Resolving deltas: 62% (229/368) Resolving deltas: 63% (233/368) Resolving deltas: 64% (236/368) Resolving deltas: 65% (240/368) Resolving deltas: 66% (243/368) Resolving deltas: 67% (247/368) Resolving deltas: 68% (251/368) Resolving deltas: 69% (254/368) Resolving deltas: 70% (258/368) Resolving deltas: 71% (262/368) Resolving deltas: 72% (265/368) Resolving deltas: 73% (269/368) Resolving deltas: 74% (273/368) Resolving deltas: 75% (276/368) Resolving deltas: 76% (280/368) Resolving deltas: 77% (284/368) Resolving deltas: 78% (288/368) Resolving deltas: 79% (292/368) Resolving deltas: 80% (296/368) Resolving deltas: 81% (299/368) Resolving deltas: 82% (302/368) Resolving deltas: 83% (306/368) Resolving deltas: 84% (310/368) Resolving deltas: 85% (314/368) Resolving deltas: 86% (317/368) Resolving deltas: 87% (321/368) Resolving deltas: 88% (324/368) Resolving deltas: 89% (328/368) Resolving deltas: 90% (332/368) Resolving deltas: 91% (335/368) Resolving deltas: 92% (339/368) Resolving deltas: 93% (343/368) Resolving deltas: 94% (346/368) Resolving deltas: 95% (350/368) Resolving deltas: 96% (354/368) Resolving deltas: 97% (357/368) Resolving deltas: 98% (361/368) Resolving deltas: 99% (365/368) Resolving deltas: 100% (368/368) Resolving deltas: 100% (368/368), done. HEAD is now at 42ace6c212b08c4943022981c72ca967ea62265f nvm install Found '/home/semaphore/workos-node/.nvmrc' with version <20.12.0> Downloading and installing node v20.12.0... Downloading https://nodejs.org/dist/v20.12.0/node-v20.12.0-linux-x64.tar.xz... 0.2% ##################### 29.6% ########################################################## 80.8% ######################################################################## 100.0% Computing checksum with sha256sum Checksums matched! Now using node v20.12.0 (npm v10.5.0) nvm use Found '/home/semaphore/workos-node/.nvmrc' with version <20.12.0> Now using node v20.12.0 (npm v10.5.0) bash ~/workos-node/bin/restore-or-install HIT: 'node-modules-cbafef60187d751053d5d763721fbc2c', using key 'node-modules-cbafef60187d751053d5d763721fbc2c'. Downloading key 'node-modules-cbafef60187d751053d5d763721fbc2c'... Download complete. Duration: 185.511872ms. Size: 19.8M bytes. Unpacking '/tmp/node-modules-cbafef60187d751053d5d763721fbc2c-418779563'... Unpack complete. Duration: 689.090901ms. Restored: ./node_modules/. yarn test yarn run v1.22.19 $ jest FAIL src/user-management/user-management.spec.ts (10.207 s) UserManagement getUser ✕ sends a Get User request (298 ms) listUsers ✕ lists users (458 ms) ✕ sends the correct params when filtering (366 ms) createUser ✕ sends a Create User request (167 ms) authenticateUserWithMagicAuth ✕ sends a magic auth authentication request (169 ms) authenticateUserWithPassword ✕ sends an password authentication request (213 ms) authenticateUserWithCode ✕ sends a token authentication request (171 ms) when the code is for an impersonator ✕ deserializes the impersonator metadata (178 ms) authenticateWithRefreshToken ✕ sends a refresh_token authentication request (177 ms) authenticateUserWithTotp ✕ sends a token authentication request (260 ms) authenticateUserWithEmailVerification ✕ sends an email verification authentication request (163 ms) authenticateWithOrganizationSelection ✕ sends an Organization Selection Authentication request (208 ms) sendVerificationEmail ✕ sends a Create Email Verification Challenge request (164 ms) verifyEmail ✕ sends a Complete Email Verification request (173 ms) sendMagicAuthCode ✕ sends a Send Magic Auth Code request (179 ms) sendPasswordResetEmail ✕ sends a Send Password Reset Email request (173 ms) resetPassword ✕ sends a Reset Password request (355 ms) updateUser ✕ sends a updateUser request (166 ms) when only one property is provided ✕ sends a updateUser request (179 ms) enrollAuthFactor ✕ sends an enrollAuthFactor request (171 ms) listAuthFactors ✕ sends a listAuthFactors request (167 ms) deleteUser ✕ sends a deleteUser request (193 ms) getOrganizationMembership ✕ sends a Get OrganizationMembership request (181 ms) listOrganizationMemberships ✕ lists organization memberships (188 ms) ✕ sends the correct params when filtering (169 ms) createOrganizationMembership ✕ sends a create organization membership request (175 ms) updateOrganizationMembership ✕ sends an update organization membership request (189 ms) deleteOrganizationMembership ✕ sends a deleteOrganizationMembership request (182 ms) getInvitation ✕ sends a Get Invitation request (265 ms) listInvitations ✕ lists invitations (185 ms) ✕ sends the correct params when filtering (173 ms) sendInvitation ✕ sends a Send Invitation request (164 ms) ✕ sends the correct params when provided (163 ms) revokeInvitation ✕ send a Revoke Invitation request (164 ms) revokeSession ✕ sends a Revoke Session request (154 ms) getAuthorizationUrl with no custom api hostname ✓ generates an authorize url with the default api hostname (3 ms) with no domain or provider ✓ throws an error for incomplete arguments (1 ms) with a provider ✓ generates an authorize url with the provider (1 ms) with a connectionId ✓ generates an authorize url with the connection with an organizationId ✓ generates an authorization URL with the organization (1 ms) with a custom api hostname ✓ generates an authorize url with the custom api hostname with state ✓ generates an authorize url with the provided state with domainHint ✓ generates an authorize url with the provided domain hint (1 ms) with loginHint ✓ generates an authorize url with the provided login hint (1 ms) getLogoutUrl ✓ returns a logout url (1 ms) getJwksUrl ✓ returns the jwks url ✓ throws an error if the clientId is blank (28 ms) ● UserManagement › getUser › sends a Get User request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listUsers › lists users UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listUsers › sends the correct params when filtering UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › createUser › sends a Create User request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateUserWithMagicAuth › sends a magic auth authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateUserWithPassword › sends an password authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateUserWithCode › sends a token authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateUserWithCode › when the code is for an impersonator › deserializes the impersonator metadata OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateWithRefreshToken › sends a refresh_token authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateUserWithTotp › sends a token authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateUserWithEmailVerification › sends an email verification authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › authenticateWithOrganizationSelection › sends an Organization Selection Authentication request OauthException: Error: invalid_client Error Description: Invalid client id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › sendVerificationEmail › sends a Create Email Verification Challenge request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › sendVerificationEmail › verifyEmail › sends a Complete Email Verification request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › sendMagicAuthCode › sends a Send Magic Auth Code request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › sendPasswordResetEmail › sends a Send Password Reset Email request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › resetPassword › sends a Reset Password request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › updateUser › sends a updateUser request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:147:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › updateUser › when only one property is provided › sends a updateUser request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:147:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › enrollAuthFactor › sends an enrollAuthFactor request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listAuthFactors › sends a listAuthFactors request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › deleteUser › sends a deleteUser request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:159:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › getOrganizationMembership › sends a Get OrganizationMembership request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listOrganizationMemberships › lists organization memberships UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listOrganizationMemberships › sends the correct params when filtering UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › createOrganizationMembership › sends a create organization membership request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › updateOrganizationMembership › sends an update organization membership request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:147:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › deleteOrganizationMembership › sends a deleteOrganizationMembership request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:159:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › getInvitation › sends a Get Invitation request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listInvitations › lists invitations UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › listInvitations › sends the correct params when filtering UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › sendInvitation › sends a Send Invitation request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › sendInvitation › sends the correct params when provided UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › revokeInvitation › send a Revoke Invitation request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● UserManagement › revokeSession › sends a Revoke Session request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) FAIL src/mfa/mfa.spec.ts MFA getFactor ✕ returns the requested factor (365 ms) deleteFactor ✕ sends request to delete a Factor (176 ms) enrollFactor with generic ✕ enrolls a factor with generic type (380 ms) with totp ✕ enrolls a factor with totp type (147 ms) with sms ✕ enrolls a factor with sms type (126 ms) when phone number is invalid ✕ throws an exception (142 ms) challengeFactor with no sms template ✕ challenge a factor with no sms template (134 ms) with sms template ✕ challenge a factor with sms template (115 ms) verifyChallenge verify with successful response ✕ verifies a successful factor (132 ms) when the challenge has been previously verified ✕ throws an exception (148 ms) when the challenge has expired ✕ throws an exception (142 ms) ✕ exception has code (153 ms) ● MFA › getFactor › returns the requested factor UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● MFA › deleteFactor › sends request to delete a Factor UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:159:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● MFA › enrollFactor › with generic › enrolls a factor with generic type TypeError: Cannot read properties of null (reading 'object') 21 | factor: FactorWithSecretsResponse, 22 | ): FactorWithSecrets => ({ > 23 | object: factor.object, | ^ 24 | id: factor.id, 25 | createdAt: factor.created_at, 26 | updatedAt: factor.updated_at, at deserializeFactorWithSecrets (src/mfa/serializers/factor.serializer.ts:23:18) at Mfa. (src/mfa/mfa.ts:61:40) at fulfilled (src/mfa/mfa.ts:5:58) ● MFA › enrollFactor › with totp › enrolls a factor with totp type TypeError: Cannot read properties of null (reading 'object') 21 | factor: FactorWithSecretsResponse, 22 | ): FactorWithSecrets => ({ > 23 | object: factor.object, | ^ 24 | id: factor.id, 25 | createdAt: factor.created_at, 26 | updatedAt: factor.updated_at, at deserializeFactorWithSecrets (src/mfa/serializers/factor.serializer.ts:23:18) at Mfa. (src/mfa/mfa.ts:61:40) at fulfilled (src/mfa/mfa.ts:5:58) ● MFA › enrollFactor › with sms › enrolls a factor with sms type TypeError: Cannot read properties of null (reading 'object') 21 | factor: FactorWithSecretsResponse, 22 | ): FactorWithSecrets => ({ > 23 | object: factor.object, | ^ 24 | id: factor.id, 25 | createdAt: factor.created_at, 26 | updatedAt: factor.updated_at, at deserializeFactorWithSecrets (src/mfa/serializers/factor.serializer.ts:23:18) at Mfa. (src/mfa/mfa.ts:61:40) at fulfilled (src/mfa/mfa.ts:5:58) ● MFA › enrollFactor › with sms › when phone number is invalid › throws an exception expect(received).rejects.toThrow(expected) Expected constructor: UnprocessableEntityException Received constructor: TypeError Received message: "Cannot read properties of null (reading 'object')" 21 | factor: FactorWithSecretsResponse, 22 | ): FactorWithSecrets => ({ > 23 | object: factor.object, | ^ 24 | id: factor.id, 25 | createdAt: factor.created_at, 26 | updatedAt: factor.updated_at, at deserializeFactorWithSecrets (src/mfa/serializers/factor.serializer.ts:23:18) at Mfa. (src/mfa/mfa.ts:61:40) at fulfilled (src/mfa/mfa.ts:5:58) at Object.toThrow (node_modules/expect/build/index.js:218:22) at src/mfa/mfa.spec.ts:206:21 at src/mfa/mfa.spec.ts:8:71 at Object..__awaiter (src/mfa/mfa.spec.ts:4:12) at Object. (src/mfa/mfa.spec.ts:185:46) ● MFA › challengeFactor › with no sms template › challenge a factor with no sms template TypeError: Cannot read properties of null (reading 'object') 4 | challenge: ChallengeResponse, 5 | ): Challenge => ({ > 6 | object: challenge.object, | ^ 7 | id: challenge.id, 8 | createdAt: challenge.created_at, 9 | updatedAt: challenge.updated_at, at deserializeChallenge (src/mfa/serializers/challenge.serializer.ts:6:21) at Mfa. (src/mfa/mfa.ts:73:32) at fulfilled (src/mfa/mfa.ts:5:58) ● MFA › challengeFactor › with sms template › challenge a factor with sms template TypeError: Cannot read properties of null (reading 'object') 4 | challenge: ChallengeResponse, 5 | ): Challenge => ({ > 6 | object: challenge.object, | ^ 7 | id: challenge.id, 8 | createdAt: challenge.created_at, 9 | updatedAt: challenge.updated_at, at deserializeChallenge (src/mfa/serializers/challenge.serializer.ts:6:21) at Mfa. (src/mfa/mfa.ts:73:32) at fulfilled (src/mfa/mfa.ts:5:58) ● MFA › verifyChallenge › verify with successful response › verifies a successful factor TypeError: Cannot read properties of null (reading 'challenge') 5 | verifyResponse: VerifyResponseResponse, 6 | ): VerifyResponse => ({ > 7 | challenge: deserializeChallenge(verifyResponse.challenge), | ^ 8 | valid: verifyResponse.valid, 9 | }); 10 | at deserializeVerifyResponse (src/mfa/serializers/verify-response.serializer.ts:7:50) at Mfa. (src/mfa/mfa.ts:93:37) at fulfilled (src/mfa/mfa.ts:5:58) ● MFA › verifyChallenge › when the challenge has been previously verified › throws an exception expect(received).rejects.toThrow(expected) Expected constructor: UnprocessableEntityException Received constructor: TypeError Received message: "Cannot read properties of null (reading 'challenge')" 5 | verifyResponse: VerifyResponseResponse, 6 | ): VerifyResponse => ({ > 7 | challenge: deserializeChallenge(verifyResponse.challenge), | ^ 8 | valid: verifyResponse.valid, 9 | }); 10 | at deserializeVerifyResponse (src/mfa/serializers/verify-response.serializer.ts:7:50) at Mfa. (src/mfa/mfa.ts:93:37) at fulfilled (src/mfa/mfa.ts:5:58) at Object.toThrow (node_modules/expect/build/index.js:218:22) at src/mfa/mfa.spec.ts:359:19 at src/mfa/mfa.spec.ts:8:71 at Object..__awaiter (src/mfa/mfa.spec.ts:4:12) at Object. (src/mfa/mfa.spec.ts:338:44) ● MFA › verifyChallenge › when the challenge has expired › throws an exception expect(received).rejects.toThrow(expected) Expected constructor: UnprocessableEntityException Received constructor: TypeError Received message: "Cannot read properties of null (reading 'challenge')" 5 | verifyResponse: VerifyResponseResponse, 6 | ): VerifyResponse => ({ > 7 | challenge: deserializeChallenge(verifyResponse.challenge), | ^ 8 | valid: verifyResponse.valid, 9 | }); 10 | at deserializeVerifyResponse (src/mfa/serializers/verify-response.serializer.ts:7:50) at Mfa. (src/mfa/mfa.ts:93:37) at fulfilled (src/mfa/mfa.ts:5:58) at Object.toThrow (node_modules/expect/build/index.js:218:22) at src/mfa/mfa.spec.ts:388:19 at src/mfa/mfa.spec.ts:8:71 at Object..__awaiter (src/mfa/mfa.spec.ts:4:12) at Object. (src/mfa/mfa.spec.ts:367:44) ● MFA › verifyChallenge › when the challenge has expired › exception has code expect(received).toMatchObject(expected) - Expected - 3 + Received + 1 - Object { - "code": "authentication_challenge_expired", - } + [TypeError: Cannot read properties of null (reading 'challenge')] 414 | }); 415 | } catch (error) { > 416 | expect(error).toMatchObject({ | ^ 417 | code: 'authentication_challenge_expired', 418 | }); 419 | } at src/mfa/mfa.spec.ts:416:25 at Generator.throw () at rejected (src/mfa/mfa.spec.ts:6:65) FAIL src/directory-sync/directory-sync.spec.ts DirectorySync listDirectories with options ✕ requests Directories with query parameters (149 ms) getDirectory ✕ requests a Directory (159 ms) deleteDirectory ✕ sends a request to delete the directory (194 ms) getGroup ✕ requests a Directory Group (177 ms) listGroups with a Directory ✕ requests a Directory's Groups (179 ms) with a User ✕ requests a Directory's Groups (175 ms) listUsers with a Directory ✕ requests a Directory's Users (163 ms) with custom attributes ✕ returns the custom attributes, using the provided type (373 ms) with a Group ✕ requests a Directory's Users (162 ms) getUser ✕ requests a Directory User (363 ms) ● DirectorySync › listDirectories › with options › requests Directories with query parameters UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › getDirectory › requests a Directory UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › deleteDirectory › sends a request to delete the directory UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:159:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › getGroup › requests a Directory Group UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › listGroups › with a Directory › requests a Directory's Groups UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › listGroups › with a User › requests a Directory's Groups UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › listUsers › with a Directory › requests a Directory's Users UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › listUsers › with a Directory › with custom attributes › returns the custom attributes, using the provided type UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › listUsers › with a Group › requests a Directory's Users UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● DirectorySync › getUser › requests a Directory User UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) (node:4421) WorkOS: The `domain` parameter for `getAuthorizationURL` is deprecated. Please use `organization` instead. (Use `node --trace-warnings ...` to show where the warning was created) (node:4421) WorkOS: The `domain` parameter for `getAuthorizationURL` is deprecated. Please use `organization` instead. (node:4421) WorkOS: The `domain` parameter for `getAuthorizationURL` is deprecated. Please use `organization` instead. FAIL src/sso/sso.spec.ts SSO SSO with options ✕ requests Connections with query parameters (163 ms) getAuthorizationUrl with no custom api hostname ✓ generates an authorize url with the default api hostname (2 ms) with no domain or provider ✓ throws an error for incomplete arguments with a provider ✓ generates an authorize url with the provider (1 ms) with a connection ✓ generates an authorize url with the connection (1 ms) with an `organization` ✓ generates an authorization URL with the organization (1 ms) with a custom api hostname ✓ generates an authorize url with the custom api hostname with state ✓ generates an authorize url with the provided state (1 ms) with domainHint ✓ generates an authorize url with the provided domain hint (1 ms) with loginHint ✓ generates an authorize url with the provided login hint getProfileAndToken with all information provided ✕ sends a request to the WorkOS api for a profile (202 ms) without a groups attribute ✕ sends a request to the WorkOS api for a profile (213 ms) getProfile ✕ calls the `/sso/profile` endpoint with the provided access token (157 ms) deleteConnection ✕ sends request to delete a Connection (155 ms) getConnection ✕ requests a Connection (164 ms) listConnections ✕ requests a list of Connections (167 ms) ● SSO › SSO › with options › requests Connections with query parameters UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● SSO › SSO › getProfileAndToken › with all information provided › sends a request to the WorkOS api for a profile OauthException: Error: invalid_client Error Description: Invalid client_id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● SSO › SSO › getProfileAndToken › without a groups attribute › sends a request to the WorkOS api for a profile OauthException: Error: invalid_client Error Description: Invalid client_id. 209 | default: { 210 | if (error || errorDescription) { > 211 | throw new OauthException( | ^ 212 | status, 213 | requestID, 214 | error, at WorkOS.handleFetchError (src/workos.ts:211:19) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● SSO › SSO › getProfile › calls the `/sso/profile` endpoint with the provided access token UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● SSO › SSO › deleteConnection › sends request to delete a Connection UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:159:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● SSO › SSO › getConnection › requests a Connection UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● SSO › SSO › listConnections › requests a list of Connections UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) PASS src/audit-logs/audit-logs.spec.ts AuditLogs createEvent with an idempotency key ✓ includes an idempotency key with request (2 ms) when the api responds with a 200 ✓ returns void (1 ms) when the api responds with a 401 ✓ throws an UnauthorizedException (12 ms) when the api responds with a 400 ✓ throws an BadRequestException (1 ms) createExport when the api responds with a 201 ✓ returns `audit_log_export` (1 ms) when additional filters are defined ✓ returns `audit_log_export` when the api responds with a 401 ✓ throws an UnauthorizedException (1 ms) getExport when the api responds with a 201 ✓ returns `audit_log_export` (1 ms) when the api responds with a 401 ✓ throws an UnauthorizedException (1 ms) FAIL src/organizations/organizations.spec.ts Organizations listOrganizations without any options ✕ returns organizations and metadata (154 ms) with the domain option ✕ forms the proper request to the API (219 ms) with the before option ✕ forms the proper request to the API (155 ms) with the after option ✕ forms the proper request to the API (162 ms) with the limit option ✕ forms the proper request to the API (180 ms) createOrganization with an idempotency key ✕ includes an idempotency key with request (163 ms) with a valid payload ✕ creates an organization (184 ms) with an invalid payload ✕ returns an error (187 ms) getOrganization ✕ requests an Organization (143 ms) deleteOrganization ✕ sends request to delete an Organization (141 ms) updateOrganization with a valid payload ✕ updates an organization (160 ms) ● Organizations › listOrganizations › without any options › returns organizations and metadata UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › listOrganizations › with the domain option › forms the proper request to the API UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › listOrganizations › with the before option › forms the proper request to the API UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › listOrganizations › with the after option › forms the proper request to the API UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › listOrganizations › with the limit option › forms the proper request to the API UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › createOrganization › with an idempotency key › includes an idempotency key with request UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › createOrganization › with a valid payload › creates an organization UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › createOrganization › with an invalid payload › returns an error expect(received).rejects.toThrowError(expected) Expected substring: "An Organization with the domain example.com already exists." Received message: "Could not authorize the request. Maybe your API key is invalid?" 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) at Object.toThrowError (node_modules/expect/build/index.js:218:22) at src/organizations/organizations.spec.ts:176:19 at src/organizations/organizations.spec.ts:8:71 at Object..__awaiter (src/organizations/organizations.spec.ts:4:12) at Object. (src/organizations/organizations.spec.ts:165:41) ● Organizations › getOrganization › requests an Organization UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › deleteOrganization › sends request to delete an Organization UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:159:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Organizations › updateOrganization › with a valid payload › updates an organization UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:147:12) at Generator.throw () at rejected (src/workos.ts:6:65) PASS src/webhooks/webhooks.spec.ts Webhooks constructEvent with the correct payload, sig_header, and secret ✓ returns a webhook event (6 ms) with the correct payload, sig_header, secret, and tolerance ✓ returns a webhook event (2 ms) with an empty header ✓ raises an error (25 ms) with an empty signature hash ✓ raises an error (1 ms) with an incorrect signature hash ✓ raises an error (1 ms) with an incorrect payload ✓ raises an error (1 ms) with an incorrect webhook secret ✓ raises an error (9 ms) with a timestamp outside tolerance ✓ raises an error (8 ms) verifyHeader ✓ returns true when the signature is valid (1 ms) getTimestampAndSignatureHash ✓ returns the timestamp and signature when the signature is valid (1 ms) computeSignature ✓ returns the computed signature (1 ms) FAIL src/workos.spec.ts WorkOS constructor when no API key is provided ✓ throws a NoApiKeyFoundException error (11 ms) when API key is provided with environment variable ✓ initializes when API key is provided with constructor ✓ initializes (1 ms) with https option ✓ sets baseURL with apiHostname option ✓ sets baseURL with port option ✓ sets baseURL when the `config` option is provided ✕ applies the configuration to the fetch client (156 ms) version ✓ matches the version in `package.json` (2 ms) post when the api responds with a 404 ✕ throws a NotFoundException (156 ms) ✕ preserves the error code, status, and message from the underlying response (372 ms) ✕ includes the path in the message if there is no message in the response (159 ms) when the api responds with a 500 and no error/error_description ✕ throws an GenericServerException (155 ms) when the api responds with a 400 and an error/error_description ✕ throws an OauthException (150 ms) when the entity is null ✕ sends a null body (157 ms) ● WorkOS › constructor › when the `config` option is provided › applies the configuration to the fetch client NotFoundException: Cannot POST /somewhere 200 | } 201 | case 404: { > 202 | throw new NotFoundException({ | ^ 203 | code, 204 | message, 205 | path, at WorkOS.handleFetchError (src/workos.ts:202:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● WorkOS › post › when the api responds with a 404 › throws a NotFoundException expect(received).rejects.toStrictEqual(expected) // deep equality Expected: [NotFoundException: Not Found] Received: [NotFoundException: Cannot POST /path] 115 | const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); 116 | > 117 | await expect(workos.post('/path', {})).rejects.toStrictEqual( | ^ 118 | new NotFoundException({ 119 | message, 120 | path: '/path', at Object.toStrictEqual (node_modules/expect/build/index.js:218:22) at src/workos.spec.ts:117:56 at src/workos.spec.ts:8:71 at Object..__awaiter (src/workos.spec.ts:4:12) at Object. (src/workos.spec.ts:108:51) ● WorkOS › post › when the api responds with a 404 › preserves the error code, status, and message from the underlying response expect(received).rejects.toMatchObject(expected) - Expected - 2 + Received + 2 Object { - "code": "thing-not-found", - "message": "The thing you are looking for is not here.", + "code": undefined, + "message": "Cannot POST /path", "status": 404, } 134 | const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); 135 | > 136 | await expect(workos.post('/path', {})).rejects.toMatchObject({ | ^ 137 | code, 138 | message, 139 | status: 404, at Object.toMatchObject (node_modules/expect/build/index.js:218:22) at src/workos.spec.ts:136:56 at src/workos.spec.ts:8:71 at Object..__awaiter (src/workos.spec.ts:4:12) at Object. (src/workos.spec.ts:126:99) ● WorkOS › post › when the api responds with a 404 › includes the path in the message if there is no message in the response expect(received).rejects.toMatchObject(expected) - Expected - 2 + Received + 2 Object { - "code": "thing-not-found", - "message": "The requested path '/path/to/thing/that-aint-there' could not be found.", + "code": undefined, + "message": "Cannot POST /path/to/thing/that-aint-there", "status": 404, } 151 | const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); 152 | > 153 | await expect(workos.post(path, {})).rejects.toMatchObject({ | ^ 154 | code, 155 | message: `The requested path '${path}' could not be found.`, 156 | status: 404, at Object.toMatchObject (node_modules/expect/build/index.js:218:22) at src/workos.spec.ts:153:53 at src/workos.spec.ts:8:71 at Object..__awaiter (src/workos.spec.ts:4:12) at Object. (src/workos.spec.ts:143:96) ● WorkOS › post › when the api responds with a 500 and no error/error_description › throws an GenericServerException expect(received).rejects.toStrictEqual(expected) // deep equality Expected: [GenericServerException: The request could not be completed.] Received: [NotFoundException: Cannot POST /path] 171 | const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); 172 | > 173 | await expect(workos.post('/path', {})).rejects.toStrictEqual( | ^ 174 | new GenericServerException(500, undefined, {}, 'a-request-id'), 175 | ); 176 | }); at Object.toStrictEqual (node_modules/expect/build/index.js:218:22) at src/workos.spec.ts:173:56 at src/workos.spec.ts:8:71 at Object..__awaiter (src/workos.spec.ts:4:12) at Object. (src/workos.spec.ts:162:57) ● WorkOS › post › when the api responds with a 400 and an error/error_description › throws an OauthException expect(received).rejects.toStrictEqual(expected) // deep equality Expected: [OauthException: Error: error Error Description: error description] Received: [NotFoundException: Cannot POST /path] 188 | const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); 189 | > 190 | await expect(workos.post('/path', {})).rejects.toStrictEqual( | ^ 191 | new OauthException( 192 | 400, 193 | 'a-request-id', at Object.toStrictEqual (node_modules/expect/build/index.js:218:22) at src/workos.spec.ts:190:56 at src/workos.spec.ts:8:71 at Object..__awaiter (src/workos.spec.ts:4:12) at Object. (src/workos.spec.ts:179:49) ● WorkOS › post › when the entity is null › sends a null body NotFoundException: Cannot POST /somewhere 200 | } 201 | case 404: { > 202 | throw new NotFoundException({ | ^ 203 | code, 204 | message, 205 | path, at WorkOS.handleFetchError (src/workos.ts:202:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) FAIL src/portal/portal.spec.ts Portal generateLink with a valid organization with the sso intent ✕ returns an Admin Portal link (182 ms) with the domain_verification intent ✕ returns an Admin Portal link (166 ms) with the dsync intent ✕ returns an Admin Portal link (156 ms) with the `audit_logs` intent ✕ returns an Admin Portal link (161 ms) with the `log_streams` intent ✕ returns an Admin Portal link (150 ms) with an invalid organization ✕ throws an error (173 ms) ● Portal › generateLink › with a valid organization › with the sso intent › returns an Admin Portal link UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Portal › generateLink › with a valid organization › with the domain_verification intent › returns an Admin Portal link UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Portal › generateLink › with a valid organization › with the dsync intent › returns an Admin Portal link UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Portal › generateLink › with a valid organization › with the `audit_logs` intent › returns an Admin Portal link UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Portal › generateLink › with a valid organization › with the `log_streams` intent › returns an Admin Portal link UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Portal › generateLink › with an invalid organization › throws an error expect(received).rejects.toThrowError(expected) Expected substring: "Could not find an organization with the id, bogus-id." Received message: "Could not authorize the request. Maybe your API key is invalid?" 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) at Object.toThrowError (node_modules/expect/build/index.js:218:22) at src/portal/portal.spec.ts:134:19 at src/portal/portal.spec.ts:8:71 at Object..__awaiter (src/portal/portal.spec.ts:4:12) at Object. (src/portal/portal.spec.ts:122:40) FAIL src/organization-domains/organization-domains.spec.ts OrganizationDomains get ✕ requests an Organization Domain (172 ms) ✕ requests an Organization Domain (176 ms) verify ✕ start Organization Domain verification flow (155 ms) create ✕ creates an Organization Domain (178 ms) ● OrganizationDomains › get › requests an Organization Domain UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● OrganizationDomains › get › requests an Organization Domain UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● OrganizationDomains › verify › start Organization Domain verification flow UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● OrganizationDomains › create › creates an Organization Domain UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) FAIL src/events/events.spec.ts Event listEvents ✕ requests Events (163 ms) ✕ requests Events with a valid event name (164 ms) with options ✕ requests Events with query parameters (168 ms) ● Event › listEvents › with options › requests Events with query parameters UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Event › listEvents › requests Events UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Event › listEvents › requests Events with a valid event name UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:124:12) at Generator.throw () at rejected (src/workos.ts:6:65) FAIL src/passwordless/passwordless.spec.ts Passwordless createSession with valid options ✕ creates a passwordless session (164 ms) sendEmail with a valid session id ✕ sends a request to send a magic link email (166 ms) ● Passwordless › createSession › with valid options › creates a passwordless session UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) ● Passwordless › sendEmail › with a valid session id › sends a request to send a magic link email UnauthorizedException: Could not authorize the request. Maybe your API key is invalid? 189 | switch (status) { 190 | case 401: { > 191 | throw new UnauthorizedException(requestID); | ^ 192 | } 193 | case 422: { 194 | throw new UnprocessableEntityException({ at WorkOS.handleFetchError (src/workos.ts:191:17) at WorkOS. (src/workos.ts:105:12) at Generator.throw () at rejected (src/workos.ts:6:65) PASS src/directory-sync/utils/get-primary-email.spec.ts getPrimaryEmail ✓ returns primary email value (1 ms) Test Suites: 10 failed, 3 passed, 13 total Tests: 97 failed, 49 passed, 146 total Snapshots: 18 passed, 18 total Time: 23.807 s Ran all test suites. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Exporting environment variables Exporting SEMAPHORE_JOB_RESULT