Hello, Shopify Developers.
I’m hoping to get some advice from the community on an issue I can’t seem to solve. I’m currently developing an app using the Remix template to create an automatic discount with a cart_transform Function, but I’m stuck on a persistent error.
What I’m trying to achieve:
From my app’s UI, a user sets a discount name, percentage, and selects trigger/target products. Then, from a server-side Remix action function, I call the discountAutomaticAppCreate mutation to create the automatic discount with my custom logic.
The Problem:
When the discountAutomaticAppCreate mutation is executed, it fails with an HTTP 422 error, and I consistently receive the following userErrors message:
{“field”: [“automaticAppDiscount”, “functionId”],“message”: “Function {functionId} not found. Ensure that it is released in the current app ({client_id}), and that the app is installed.”}
What I’ve Already Tried
I feel like I’ve tried nearly every possible debugging step to resolve this:
-
Tried Multiple Function ID Formats:
-
The legacy ID from the
shopifyFunctionsGraphQL query (0199...). -
The
UIDdisplayed in the Partner Dashboard version details. -
An ARN-style ID using the Client ID and Function Handle (
shopify://...). -
All of the above formatted as a full GID (
gid://shopify/ShopifyFunction/...). -
→ All attempts result in the exact same error.
-
-
Verified Environment Configuration:
-
Unified API Version: I’ve set the
api_versionto"2025-10"in my mainshopify.app.tomland all Function.tomlfiles. -
Confirmed Client ID: I have verified that the Client ID in the Partner Dashboard, my
.envfile (SHOPIFY_API_KEY), and theshopify.app.tomlfile are all identical.
-
-
Reset the App State:
-
Completely Re-created the Function: I deleted the function directory entirely from my
extensionsfolder and created a newcart_transformfunction usingshopify app generate extension. -
Re-deployed the App: I’ve run
shopify app deploymultiple times. -
Re-installed the App: I have uninstalled and re-installed the app on my development store many times, including using the official distribution link from the Partner Dashboard.
-
A Strange Clue: The Function UID Format
One strange thing I’ve noticed is that when I deploy a Function with the API version set to 2025-10, the UID shown in the Partner Dashboard is a very long, non-standard string, not a typical UUID (8-4-4-4-12 format). While using this ID doesn’t solve the error, it feels like a clue that something fundamental is wrong.
Relevant Code
(.env File)
SHOPIFY_API_KEY=“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”SHOPIFY_API_SECRET=“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”SCOPES=“write_discounts,read_products”SHOPIFY_APP_URL=“https://my-app.vercel.app”SHOPIFY_DISCOUNT_FUNCTION_ID=“gid://shopify/ShopifyFunction/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” // I have tried all ID formats here
app/routes/app._index.jsx (action function snippet)
import { authenticate } from “../shopify.server”;
export const action = async ({ request }) => {const { admin } = await authenticate.admin(request);const formData = await request.formData();
const discountFunctionId = process.env.SHOPIFY_DISCOUNT_FUNCTION_ID;const discountTitle = formData.get(“title”);// …other variables…
const response = await admin.graphql(#graphql mutation discountAutomaticAppCreate($automaticAppDiscount: DiscountAutomaticAppInput!) { discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) { userErrors { field, message } } },{variables: {automaticAppDiscount: {title: discountTitle,functionId: discountFunctionId,startsAt: new Date().toISOString(),// …metafields},},});// …error handling};
My Questions for the Community:
Is there any other debugging step or perspective I might have missed?
-
Has anyone else encountered similar issues with Function provisioning or ID formats on newer API versions like
2025-10? -
After trying all of the above, is it reasonable to suspect this might be a Shopify platform-side issue?
Thank you for any help or insights you can provide!