Skip to content

COMOPT-1318: Update snowplow urls to be dynamic based on storefrontInstance environment#196

Closed
SarikaVanapalli wants to merge 1 commit intomainfrom
feature/snowplow-urls
Closed

COMOPT-1318: Update snowplow urls to be dynamic based on storefrontInstance environment#196
SarikaVanapalli wants to merge 1 commit intomainfrom
feature/snowplow-urls

Conversation

@SarikaVanapalli
Copy link
Collaborator

@SarikaVanapalli SarikaVanapalli commented Oct 24, 2025

Description

Problem: Snowplow endpoints were hardcoded at build time via webpack, forcing events to the prod collector regardless of the storefront’s runtime environment.

Solution: Added a small config and runtime routing based on storefrontInstance.environment (qa/stage/test → QA; otherwise → Prod), preserving eventForwarding behavior and enabling a single build to work across environments.

The snowplow url defaults to production when no environment is detected or matches with the qa options, so the existing functionality will still work as it is without any issues.

Related Issue

https://jira.corp.adobe.com/browse/COMOPT-1318

Motivation and Context

Problem: Snowplow endpoints were hardcoded at build time via webpack, forcing events to the prod collector regardless of the storefront’s runtime environment.

How Has This Been Tested?

  • Built the package (webpack prod) to ensure compilation succeeded.
  • Ran the full Jest suite; all existing tests passed.

The snowplow url defaults to production when no environment is detected or matches with the qa options, so the existing functionality will still work as it is without any issues.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@SarikaVanapalli SarikaVanapalli changed the title feat: update snowplow Urls to be dynamic based on storefrontInstance environment COMOPT-1318: Update snowplow rrls to be dynamic based on storefrontInstance environment Oct 24, 2025
Comment on lines +10 to +17
production: {
collectorUrl: "https://commerce.adobedc.net",
collectorPath: "/collector/tp2",
},
qa: {
collectorUrl: "https://com-magento-qa1.collector.snplow.net",
collectorPath: "/com.snowplowanalytics.snowplow/tp2",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be certain - it is OK to expose the QA urls to the public?

One way to protect would be to have the initialization happen at runtime, and use a default value (prod url) or allow passing a collector url/path as argument to override. Then for QA you can intentionally set this in the integration code, without exposing the potentially secret/private QA endpoint.

Copy link
Contributor

Choose a reason for hiding this comment

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

The qa urls have always been exposed in the webpack configs, so they probably won't be that big of a deal, but this change is going to have unintended consequences for magento users

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll mark this as a draft PR until we meet on Monday and decide next steps. Thanks for reviewing so quick! 🙏🏼

@SarikaVanapalli SarikaVanapalli changed the title COMOPT-1318: Update snowplow rrls to be dynamic based on storefrontInstance environment COMOPT-1318: Update snowplow urls to be dynamic based on storefrontInstance environment Oct 24, 2025
Copy link
Contributor

@benjaminkalk benjaminkalk left a comment

Choose a reason for hiding this comment

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

I don't think we can make this change. Merchants should not be sending event data to QA snowplow environment. They should be sending events to production using sandbox data space selection. Also, this would be a breaking change for all Luma test environments as we set value returned by Serviced Id configuration for the environment value.

@SarikaVanapalli SarikaVanapalli marked this pull request as draft October 24, 2025 20:58
@sirugh
Copy link
Contributor

sirugh commented Oct 25, 2025

I think the ideal outcome would be that the collector endpoint can be configured by an argument, but defaults to the same as they are today. As in, non-breaking change - prod bundle still uses prod endpooint by default, qa bundle uses qa endpoint by default. But now each build would allow passing of some argument which forces a different endpoint if provided.

Also, this would be a breaking change for all Luma test environments as we set value returned by Serviced Id configuration for the environment value.

@benjaminkalk can you clarify how this would be breaking? I don't know what you mean by "service id configuration for env value"

@SarikaVanapalli
Copy link
Collaborator Author

SarikaVanapalli commented Oct 28, 2025

As discussed with the team, this feature introduces breaking changes that will affect current ACCS merchants using the Luma storefront.
To mitigate this, a fix has been merged to use QA package versions for internal testing of Snowplow events in the QA environment.
Looking ahead to future ACO support and Snowplow URL flexibility, we will introduce a new attribute to storefrontInstance. This value will be used by the collector to determine the appropriate snowplowUrl, which defaults to production value.

Closing this PR.

cc: @sirugh @grahamcrackers @benjaminkalk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants