Skip to content

Commit

Permalink
fix: Handle custom authorizer 401 in non in-process runners (#1319)
Browse files Browse the repository at this point in the history
Co-authored-by: Romulo Campos <[email protected]>
  • Loading branch information
thejuan and romulocrj authored Jan 6, 2022
1 parent 8db63dd commit 8d61bde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/events/http/createAuthScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default function createAuthScheme(

try {
const result = await lambdaFunction.runHandler()

if (result === 'Unauthorized') return Boom.unauthorized('Unauthorized')
// return processResponse(null, result)
const policy = result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ export default class InProcessRunner {

const callbackCalled = new Promise((resolve, reject) => {
callback = (err, data) => {
if (err === 'Unauthorized') {
resolve('Unauthorized')
return
}
if (err) {
reject(err)
return
}
resolve(data)
}
Expand Down

0 comments on commit 8d61bde

Please sign in to comment.