SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
276 stars 126 forks source link

Grab correlation ID and send as a response header #1787

Closed yunakim714 closed 1 month ago

yunakim714 commented 2 months ago

Description

As part of log forwarding, we are now generating a v4 UUID Correlation ID to attach to our MRT logs so that our logs can be searched for outside of MRT. In MRT, this is now added as a new header, x-correlation-id, to the event object, which is the json representation of the HTTP request. In pwa-kit, we then need to pull this new header, modify the response, and add this header to the response so that the correlation ID value is accessible and visible to the user.

GUS: W-15706159 Linked PR to generate Correlation ID and add to Log Center logs: https://git.soma.salesforce.com/cc-mobify/portal_app/pull/5770 Linked PR to add Correlation ID to Splunk logs and log tailing: https://git.soma.salesforce.com/cc-mobify/portal_app/pull/5806

Types of Changes

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

How to Test-Drive This PR

Checklists

General

Accessibility Compliance

You must check off all items in one of the follow two lists:

or...

Localization

kevinxh commented 1 month ago

Before we merge this PR, is it possible to verify that the x-correlation-id from the incoming header, matches the SCAPI request headers, on both the server and the client side?