Skip to content

Consent API : Requests sent to malformed URL when backend consent enabled and store hosted on non-root domain #3757

@TeamAcarup

Description

@TeamAcarup

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2026.4.2

What version of React Router 7 are you using?

7.14.0

Steps to Reproduce

I have identified a bug with the consent API since enabling backend consent.

Let's say my store is hosted at www.mystore.com, the checkout is at shop.mystore.com.

I see in the console that the consent API attempts to fire a request to https://.mystore.com/api/unstable/graphql.json, which is not a valid URL.

If I send a request manually to the same URL without the leading . , the request works just fine.

I've tried looking around, and I see that in ShopifyCustomerPrivacy.tsx, we set storefrontRootDomain as

storefrontRootDomain : commonAncestorDomain
        ? '.' + commonAncestorDomain
        : undefined,

This explains the leading .

Then that storefrontRootDomain must be used in the consent-tracking-api instead of the actual root domain (mystore.com). I can't actually verify that, as the code is minified.

This results in a fetch request that fails with (failed)net::ERR_NAME_NOT_RESOLVED

If you want to take a look, here is the actual store : https://www.exaller.com/fr/

Expected Behavior

The consent API should send requests to the actual root domain

Actual Behavior

The consent API sends a request to an invalid URL that starts with a leading .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions