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

fix: adjust docs on how to stringify parsed object payloads #112

Merged
merged 1 commit into from
Jan 8, 2023
Merged

fix: adjust docs on how to stringify parsed object payloads #112

merged 1 commit into from
Jan 8, 2023

Conversation

pjungermann
Copy link
Contributor

Closes: #111
Signed-off-by: Patrick Jungermann Patrick.Jungermann@gmail.com


Behavior

Before the change?

After the change?

Other information

As I wrote at issue #111 not sure if this is the correct resolution. I still prepared it as it is a simple change.


Additional info

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

If Yes, what's the impact:

  • N/A

Pull request type

Please add the corresponding label for change this PR introduces:

  • Bugfix: Type: Bug
  • Feature/model/API additions: Type: Feature
  • Updates to docs or samples: Type: Documentation
  • Dependencies/code cleanup: Type: Maintenance

Closes: #111
Signed-off-by: Patrick Jungermann Patrick.Jungermann@gmail.com
@ghost ghost added this to Inbox in JS Nov 23, 2022
Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

Hmm I'm pretty sure that GitHub's event JSON payloads are not on a single line, they have space indentation and line breaks.

In your test you do a simple stringify:
https://github.com/backstage/backstage/pull/14689/files#diff-8a3494f5371a5d5b692b3c2792bd1dc4292839676128d1776dae6974915bd386R51-R52

But that's not what GitHub does. Did you confirm that it failed before hand in production and that your change fixes it? I'd like someone to confirm that is the case independently before we merge the pull request

@pjungermann
Copy link
Contributor Author

I've changed the code after verifying this behavior with a real webhook event payload and its signature received from GitHub. I didn't want to put a real payload into the tests though.

As far as I can tell, they seem to send the payload in one line. Using JSON.stringify(payload) works on parsed payload objects with the real signature value.

@frenchbread was the one reporting this to me originally.

Of course, it is good to get/make another independent cross-check.

@gr2m gr2m added the Type: Bug Something isn't working as documented label Nov 24, 2022
@ghost ghost moved this from Inbox to Bugs in JS Nov 24, 2022
@wolfy1339 wolfy1339 merged commit a705a9e into octokit:main Jan 8, 2023
JS automation moved this from Bugs to Done Jan 8, 2023
@github-actions
Copy link

github-actions bot commented Jan 8, 2023

🎉 This PR is included in version 3.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Type: Bug Something isn't working as documented
Projects
No open projects
JS
  
Done
Development

Successfully merging this pull request may close these issues.

[BUG]: docs for how to stringify parsed objects/payloads does not work
3 participants