https://discord.gg/botpress logo
Webchat crashes on Shopify - "requestURL.includes ...
# 🤝help
f
Hi everyone! 👋 I'm running into a blocking bug with the Botpress webchat embedded on my Shopify store. The chat widget loads (icon appears) but when I try to open it / send a message, nothing happens — it just hangs. Console error: TypeError: requestURL.includes is not a function at (index):186:37 at async a (inject.js:298:9224) at async (inject.js:370:40887) ​ What I've already ruled out: Not a conflict with any Shopify app (tested with all apps' embeds/scripts disabled: Hextom Shipping Bar, Judge.me, Nova Cookie Consent, Discounty, TYDAL Popups, Lably — uninstalled/disabled one by one, error persists) Not a browser extension/ad-blocker (tested in a private/incognito window, error persists) Not Shopify's Customer Events pixels (Google, Facebook, Judge.me) The error seems to come directly from inject.js itself, possibly related to how it calls fetch/handles a request URL in the Shopify environment. Has anyone seen this before, or know if it's a known compatibility issue with Shopify's storefront (e.g. its native Web Pixels sandboxing of fetch)? Happy to share more details (script setup, full console logs) if helpful. Thanks in advance! 🙏
a
I can help debug this. requestURL.includes is not a function usually means something is passing a non-string (often a Request object or another value) where the Botpress injector expects a URL string. Since you've already ruled out app conflicts and extensions, I'd focus on the webchat injection and any fetch/XHR overrides or Shopify's runtime. Could you share your Botpress embed snippet, the full stack trace, and let me know if the issue also happens on a plain HTML page outside Shopify? @flat-flag-71245
f
@BIG JIGGY$$$ Thanks for the quick reply! I just ran the test you suggested: - I created a plain, minimal HTML page with only the Botpress webchat embed snippet (nothing else, no Shopify). - The widget loads and works perfectly there: greeting message, language selection, text input all functional. No "requestURL.includes is not a function" error at all. Only a minor unrelated "Verify stylesheet URLs" console notice. This strongly suggests the issue is specific to the Shopify environment, not the webchat embed itself. My best guess is still Shopify's native Web Pixels Manager sandboxing fetch/XHR calls. Here's my embed snippet (used identically on both the test page and Shopify): [@BIG JIGGY$$$ Thanks for the quick reply! I just ran the test you suggested: - I created a plain, minimal HTML page with only the Botpress webchat embed snippet (nothing else, no Shopify). - The widget loads and works perfectly there: greeting message, language selection, text input all functional. No "requestURL.includes is not a function" error at all. Only a minor unrelated "Verify stylesheet URLs" console notice. This strongly suggests the issue is specific to the Shopify environment, not the webchat embed itself. My best guess is still Shopify's native Web Pixels Manager sandboxing fetch/XHR calls. Here's my embed snippet (used identically on both the test page and Shopify): [COLLE TON SNIPPET ICI] And the full error stack trace from Shopify's console: TypeError: requestURL.includes is not a function at (index):186:37 at inject.js:298:9224 at inject.js:370:40887 Let me know what else could help narrow this down!] And the full error stack trace from Shopify's console: TypeError: requestURL.includes is not a function at (index):186:37 at inject.js:298:9224 at inject.js:370:40887 Let me know what else could help narrow this down!
a
Interesting. So where is the Botpress embed installed—theme.liquid, a Custom Liquid block, or an App Embed? Also, could you share the code around (index):186? That should help pinpoint where requestURL is being passed I correctly. @flat-flag-71245
f
Copy code
@BIG JIGGY$$$ Found it, here's the full picture:

1. Where it's installed: Directly in theme.liquid, right before </body>:
<script src="https://cdn.botpress.cloud/webchat/v3.7/inject.js"></script>
<script src="https://files.bpcontent.cloud/2026/05/27/17/20260527175841-4566349P.js" defer></script>

2. The code around (index):186 — turns out it's NOT Botpress's own script. It's my theme's (Kalles, by The4.co) own JS that globally overrides fetch/XHR to track cart events:

} else if (requestURL.includes("/cart/add")) {
  cloneResponse.text().then( (text) => {
    let item = JSON.parse(text);
    self.singleCartItemDataLayer('add_to_cart', item);
    self.updateCart();
  });
} else if (requestURL.includes("/cart/change")) {

So my theme wraps window.fetch/XHR globally and assumes the URL argument passed to fetch is always a plain string. The console shows the crash happens during "Error sending event metrics" — so it looks like Botpress's webchat calls fetch with something that isn't a plain string (maybe a Request object?) when sending its own analytics/metrics, which breaks my theme's interceptor since Request.includes is not a function.

Does Botpress's webchat ever call fetch with a Request object or URL object internally instead of a plain string URL? That would explain why it only breaks on Shopify (which has this global fetch override) and works fine on a plain HTML page with no such override.
a
Nice find-that's a really useful clue. Since the same Botpress embed works on a plain HTML page, the evidence points more toward the Kalles theme's global fetch wrapper than the webchat itself. The Fetch API accepts both URL strings and Request objects, So if the wrapper assumes every request is a string and calls .includes (), that would explain the error. Could you log requestURL (or requestURL.constructor. name) right before the .includes () call? That'll confirm exactly what's being passed in and whether the interceptor needs to handle multiple valid fetch() input types. @flat-flag-71245