Skip to content

Conversation

vikaskumr
Copy link
Contributor

@vikaskumr vikaskumr commented Oct 2, 2025

We have to somehow distinguish between CDA and graphql in NER in app function specifically for lookupHandler.
We are adding the below type to make sure we can differentiate if the request is coming from CDA/CPA.

originalRequest?: {
    headers: Record<string, any>
  }

Context we get from function API

  "event": {
   "type": "resources.lookup",
   "resourceType": "MockShop:Product",
   "lookupBy": { "urns": ["gid://shopify/Product/7983602040854", "gid://shopify/Product/7983595388950"] },
   "limit": 1000
 },
 "context": {
   "spaceId": "f00h9rgirk2b",
   "environmentId": "6275f161-b2be-4cf2-ba5c-04f8ece63283",
   "environmentUuid": "6275f161-b2be-4cf2-ba5c-04f8ece63283",
   "requestId": "e0a9ae3f-0b0e-4b8e-ad24-8e2ac4d6df93",
   "organizationId": "00y2g65dGhRIi6Xu9X3UGy",
   "originalRequest": {
     "headers": {
       "x-contentful-request-id": "e0a9ae3f-0b0e-4b8e-ad24-8e2ac4d6df93",
       "x-contentful-host": "cdn.contentful.com",
       "accept": "*/*",
       "accept-encoding": "gzip, br",
       "user-agent": "insomnia/11.4.0",
       "x-forwarded-for": "213.10.127.95",
       "contentful-api": "cda",
       "cf-environment-id": "master",
       "cf-organization-id": "00y2g65dGhRIi6Xu9X3UGy",
       "cf-space-id": "f00h9rgirk2b"
     }
   },
   "appInstallationParameters": {},
   "appDefinitionId": "3ieR63GAbivgOrLB79PVtA",
   "appFunctionId": "MockShopTutorial"
 }
}

Dependent PR

@vikaskumr vikaskumr requested a review from a team as a code owner October 2, 2025 10:09
@vikaskumr vikaskumr merged commit ee124fe into main Oct 3, 2025
15 checks passed
@vikaskumr vikaskumr deleted the CNX-271-adding-original-request-type branch October 3, 2025 06:19
@vikaskumr vikaskumr changed the title feat[CNX-271]: adding additional types in context required for NER in… feat: adding additional types in context required for NER in CDA [CNX-271] Oct 3, 2025
@contentful-automation
Copy link
Contributor

🎉 This PR is included in version 3.14.0 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants