apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Add request data to `invalidRequestWasReceived` lifecycle event

Open Masadow opened this issue 1 year ago • 5 comments

Hi,

I want to log all request made to my API and I'm not satisfied by the didEncounterErrors because it discards Bad Request event and such.

By adding more the request object to invalidRequestWasReceived, I will be able to log information regarding the malformed request such as body and headers that will help me trouble shoot issues.

To give a concrete example, I currently have my API that is consumed by several client but one of them is intermittently spawning a lot of Bad Request issue. By having the ability to log all requests along with their headers and body content, I will be capable of identify the client that's causing the Bad Request.

Masadow avatar Jun 10 '24 16:06 Masadow

@Masadow: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

apollo-cla avatar Jun 10 '24 16:06 apollo-cla

Deploy request for apollo-server-docs pending review.

Visit the deploys page to approve it

Name Link
Latest commit 5a042f3eecb4a7a0b4dcddaf0c595443ab3b5cee

netlify[bot] avatar Jun 10 '24 16:06 netlify[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Jun 10 '24 16:06 codesandbox-ci[bot]