From 91d317b0b6dc134b3b75953afd24835682cf6236 Mon Sep 17 00:00:00 2001 From: Dylan Audius Date: Tue, 16 Jun 2026 12:22:44 -0700 Subject: [PATCH] fix(identity): correct audiusSdk accessor in authMiddleware (.full.users -> .users) authMiddleware backfills blockchainUserId/handle for users whose identity row lacks them (the state of any guest / freshly signed-up user) by calling the SDK. It used `req.app.get('audiusSdk').full.users.getUserAccount(...)`, but the @audius/sdk instance has no `.full` namespace - `users` is a top-level API. So `.full` is undefined and `.users` throws a synchronous TypeError ("Cannot read properties of undefined (reading 'users')") on EVERY new-user auth request (/users/update, /record_ip, etc). Confirmed in prod logs: TypeError: Cannot read properties of undefined (reading 'users') at authMiddleware (build/src/authMiddleware.js:97:68) msg: "Failed to update blockchainUserId/handle" The bad accessor came in with the monorepo import (#14388) and only began firing once #14474 (6/15) made loadAudiusSdk.cjs available so the SDK actually initialized - matching the signup regression window. The surrounding try/catch swallowed the error and called next(), so the backfill silently never happened for new users. Fix: use the correct accessor `audiusSdk.users.getUserAccount`. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/identity-service/src/authMiddleware.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/identity-service/src/authMiddleware.js b/packages/identity-service/src/authMiddleware.js index c4bfff3b547..d1a36f3d829 100644 --- a/packages/identity-service/src/authMiddleware.js +++ b/packages/identity-service/src/authMiddleware.js @@ -114,7 +114,7 @@ async function authMiddleware(req, res, next) { // ensuring that the user.handle always represents the latest state on chain if (!user.blockchainUserId || !user.handle) { try { - const res = await req.app.get('audiusSdk').full.users.getUserAccount({ + const res = await req.app.get('audiusSdk').users.getUserAccount({ wallet: walletAddress, encodedDataMessage, encodedDataSignature: signature @@ -181,7 +181,7 @@ const parameterizedAuthMiddleware = ({ shouldRespondBadRequest }) => { if (!user.blockchainUserId || !user.handle) { try { - const res = await req.app.get('audiusSdk').full.users.getUserAccount({ + const res = await req.app.get('audiusSdk').users.getUserAccount({ wallet: walletAddress, encodedDataMessage, encodedDataSignature: signature