Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REC-359] provide webhook verification nodejs example #65

Merged
merged 4 commits into from
May 3, 2022

Conversation

conradludgate
Copy link
Contributor

@conradludgate conradludgate commented Apr 29, 2022

Example of #47 for NodeJS

@conradludgate conradludgate requested a review from a team as a code owner April 29, 2022 14:26
@conradludgate conradludgate requested a review from a team April 29, 2022 14:26
@alexheretic
Copy link
Contributor

Thanks! We should add a link to this example in the main nodejs readme too, like

See [webhook server example](./examples/webhook-server/).

First, build the signing lib
```sh
# in the `truelayer-signing/nodejs` dir
yarn build
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it just yarn?

Suggested change
yarn build
yarn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe that works, but build is the specific script that does actually builds the lib.js file:
https://github.com/TrueLayer/truelayer-signing/blob/main/nodejs/package.json#L9

Copy link
Contributor

@alexheretic alexheretic May 3, 2022

Choose a reason for hiding this comment

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

Ah I see the directory, wouldn't just running yarn in the examples/webhook-server dir work fine in any case?

yarn is playing up for me at the moment because of jfrog, but npm i in the webhook-server does the right thing so I assume running yarn would too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Judging by @jdon's comment in the slack thread, it doesn't seem to work properly (it will pull the path dependency, but doesn't run the build script to build)

@conradludgate conradludgate merged commit ce59253 into main May 3, 2022
@conradludgate conradludgate deleted the rec-359-webhook-verification branch May 3, 2022 14:27
method: req.method,
path: req.path,
headers: req.headers,
body: JSON.stringify(req.body),
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm we shouldn't really be manipulating the body in any way before verifying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants