Skip to content

Commit

Permalink
fix: onfido webhook edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Jan 17, 2018
1 parent d67ef16 commit 8c6d8e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/samplebot/lambda/http/onfido-webhook.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/samplebot/lambda/http/onfido-webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import cors = require('kcors')
import { createBot } from '../../../bot'
import { customize } from '../../customize'
import { post } from '../../../bot/middleware/noop-route'
import Errors = require('../../../errors')

const bot = createBot({ ready: false })
const lambda = bot.createLambda({ source: EventSource.HTTP })
Expand All @@ -12,6 +13,10 @@ lambda.use(post())
lambda.use(cors())
lambda.use(async (ctx) => {
const { onfidoPlugin } = await promiseCustomize
if (!onfidoPlugin) {
throw new Errors.HttpError(404, 'not found')
}

await onfidoPlugin.processWebhookEvent({
req: ctx.request.req
})
Expand Down

0 comments on commit 8c6d8e3

Please sign in to comment.