Skip to content

Commit

Permalink
fix: grab auth token before await (#9292)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Krick <matt.krick@gmail.com>
  • Loading branch information
mattkrick authored Dec 18, 2023
1 parent 9c3f372 commit 86db0dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/server/graphql/uWSAsyncHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type uWSHandler = (res: HttpResponse, req: HttpRequest) => void
const uWSAsyncHandler =
(handler: uWSHandler, ignoreDone?: boolean) => async (res: HttpResponse, req: HttpRequest) => {
safetyPatchRes(res)
const authToken = getReqAuth(req)
try {
await handler(res, req)
if (!ignoreDone && !res.done) {
Expand All @@ -15,7 +16,6 @@ const uWSAsyncHandler =
} catch (e) {
res.writeStatus('503').end()
const error = e instanceof Error ? e : new Error('uWSAsyncHandler failed')
const authToken = getReqAuth(req)
sendToSentry(error, {userId: authToken.sub})
}
}
Expand Down

0 comments on commit 86db0dc

Please sign in to comment.