octokit / webhooks.js

GitHub webhook events toolset for Node.js
MIT License
315 stars 79 forks source link

What's the difference between `x-request-id` and `x-github-delivery`? #579

Open ScottChapman opened 3 years ago

ScottChapman commented 3 years ago

I see both referenced in the docs and used as an id. But not clear what they are exactly. I suspect one is unique to the event, but not sure which one, and then what the other one is!

gr2m commented 3 years ago

If I recall correctly, x-github-delivery is the event ID. An event is something like "a new pull request was created". A single event can create multiple webhook event requests though, and each webhook request gets its own ID. That's what X-GitHub-Hook-ID is, I think. I don't think we use that anywhere though.. I'm not sure where you have seen x-request-id in the context of webhooks? It's usually set on API responses, I don't think that it's set on webhook requests

ScottChapman commented 3 years ago

saw it here: https://github.com/probot/probot/blob/ce9688493029f32a5abdeb3a4fb91d56d00c18e5/src/server/logging-middleware.ts#L19

And I think I saw it on inbound events

gr2m commented 3 years ago

It's a very good question. I don't see the header listed on https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#delivery-headers, but maybe it should?

I see the header when testing with smee.io. I also see x-request-start which I think should be documented as well. Could you maybe file an issue on https://github.com/github/docs and ask about that? You can reference this issue and ping me in it

ScottChapman commented 3 years ago

smee isn't adding anything is it?

gr2m commented 3 years ago

No

gr2m commented 3 years ago

blocked by https://github.com/github/docs/issues/7005