Bug: Intents API not working in mobile app

Hi there. I’m not sure if this is new, but one of my app users just reached out that the product creation with the “intents” API is not working via the mobile app. It works fine in the browser. You can recreate this in the “react-router” template with this code on the app.additional.tsx page, and then load the additional page and click the button on the browser and in the app. On the browser it loads a new product form, on mobile in the Shopify app it doesn’t do anything, at least for me and apparently my user:

import { useAppBridge } from "@shopify/app-bridge-react";
import { useCallback } from "react";

export default function Demo() {
  const shopify = useAppBridge();
  const createProduct = useCallback(async () => {
    return shopify.intents.invoke!({
      action: "create",
      type: "shopify/Product",
    })
      .then((activity) => activity.complete)
      .then(async (result) => {
        console.log(result);
      })
      .catch((error) => {
        console.error("Error creating product", error);
      });
  }, [shopify]);
  return (
    <s-page heading="Additional page">
      <s-button onClick={createProduct}>Create product</s-button>
    </s-page>
  );
}

Copying @Liam-Shopify and @Alan_G, whom I see have helped with support in this category recently.

Hey @_Ryan - interesting that this is only happening in the mobile app. Out of curiosity, if they use a mobile browser like Safari/Chrome (as well as a desktop one), does the function work as expected via App Bridge?

Just want to narrow down if it’s an issue that’s specific to the Mobile App itself if that makes sense. If your user is also able to share the version of the Mobile App they’re using (the most recent is 10.2543.0, last updated yesterday on both Google Play/Apple), that would be helpful too.

Hope to hear from you soon.

Thanks for the reply @Alan_G. I have just re-tested my app as well as the code snippet above, and now it works as expected in the mobile app. I’m not sure if there has been an update to the app in the meantime. I’ve reached out to my merchant with the issue to confirm the issue is resolved for them (and I advised them to update to the latest app version). I’ll come back and ping you with more info if it’s not, but I expect it will be.

Heard back. It’s working!

Great to hear, thanks for following up @_Ryan ! Let me know if you see this pop up again (just @ me in this thread) and I’d be happy to take a look. I’ll mark this thread as Solved for now, just for tracking on our end :slight_smile: