fix(ep-commerce): resolve EP host when multiple global contexts share a module - #408
Merged
Merged
Conversation
CMS/Strapi host defaults in the same module were winning first-match and breaking OAuth bootstrap; collect all host matches and favor custom+customHost.
Group clientId / host / customHost / serverCartMode by the props identifier codegen binds per global context, so a module nesting CMS, Strapi or another commerce provider alongside EP can no longer contribute one provider's field to another's config. Restores the original custom-host resolution now that it reads a single provider's props. Allowlist rejections are collected and reported only when no candidate resolves, so a project using a second commerce provider does not log an allowlist error for that provider's host on a working storefront.
field123
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this MR do?
Fixes
extractEpProviderConfigso it no longer takes the firsthost:default in a Plasmic global-contexts module. When CMS/Strapi/Shopify are nested with the EP Provider in oneglobal__*.js, the first match was often Plasmic CMS’shttps://data.plasmic.app, which the host allowlist rejects — leaving no usable EP config and breaking anonymous OAuth for storefronts that resolve credentials from the loader bundle.Changes
host === "custom"+customHostwhen present in the modulecustomhost so allowlist rejection still logs a useful valueDesign decisions
hostcustom+customHost) is a reliable signal without coupling to CMS prop namesTesting
data.plasmic.appallowlist / bootstrap 401Reviewer notes
extractEpProviderConfig/buildEpCtx/resolveConfigfrom the Plasmic bundleclientId/hostintocreateEpAuthand don’t rely on bundle extraction are unaffected