Skip to content

Commit

Permalink
chore: Throw error for expired token to make it easier to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Jan 14, 2024
1 parent bf32db5 commit aa6b894
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kits/cdk/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,16 @@ export const makeJwtClient = zFunction(
message: 'JWT payload must be an object, not a string.',
})
}
// console.log('jwt.verify', data)
return zViewerFromJwtPayload.parse(data)
} catch (err) {
if (!`${err}`.includes('TokenExpiredError')) {
// This dependency is not great... But don't know of a better pattern for now
throw new TRPCError({code: 'UNAUTHORIZED', message: `${err}`})
}
return {role: 'anon'}
// console.log('jwt.verify Error', err)
// Actually throw token expired errror
throw new TRPCError({code: 'UNAUTHORIZED', message: `${err}`})
// if (!`${err}`.includes('TokenExpiredError')) {
// // This dependency is not great... But don't know of a better pattern for now
// }
// return {role: 'anon'}
}
},
signViewer: (
Expand Down

1 comment on commit aa6b894

@vercel
Copy link

@vercel vercel bot commented on aa6b894 Jan 14, 2024

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

venice – ./

usevenice.vercel.app
venice-venice.vercel.app
venice-git-production-venice.vercel.app
app.venice.is

Please sign in to comment.