Debugging Shopify function deployment issues

Topic summary

A developer is encountering a persistent HTTP 422 error when attempting to create an automatic discount using Shopify’s discountAutomaticAppCreate mutation with a custom cart_transform Function in a Remix app.

Core Issue:
The mutation fails with a “Function not found” error, indicating Shopify cannot recognize the function as released to the app, despite the function appearing to be properly configured.

Attempted Solutions:

  • Tested multiple function ID formats (legacy ID, UID, ARN-style, full GID)
  • Verified API version consistency (2025-10) across all configuration files
  • Confirmed Client ID matches across Partner Dashboard, environment variables, and config files
  • Completely recreated the function and redeployed the app
  • Reinstalled the app on the development store

Current Status:
All troubleshooting attempts have failed to resolve the issue. A community member suggests the problem lies in how the function is registered and deployed within the Remix app architecture, rather than just configuration settings. The discussion remains open with an offer to review the setup directly.

Summarized with AI on October 24. AI used: claude-sonnet-4-5-20250929.

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 shopifyFunctions GraphQL query (0199...).

    • The UID displayed 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_version to "2025-10" in my main shopify.app.toml and all Function .toml files.

    • Confirmed Client ID: I have verified that the Client ID in the Partner Dashboard, my .env file (SHOPIFY_API_KEY), and the shopify.app.toml file are all identical.

  • Reset the App State:

    • Completely Re-created the Function: I deleted the function directory entirely from my extensions folder and created a new cart_transform function using shopify app generate extension.

    • Re-deployed the App: I’ve run shopify app deploy multiple 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?

  1. Has anyone else encountered similar issues with Function provisioning or ID formats on newer API versions like 2025-10?

  2. 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!

That error means Shopify isn’t recognizing your function as released to the app, which is why every format you try fails. It’s not just the ID format it’s how the function is registered and deployed in your setup. This isn’t something settings alone will fix, it needs a closer look at how your Remix app, toml config, and function deployment are tied together.

I’ve fixed this exact issue before if you’d like, I can review your setup and apply the correction so the discount function links properly and the mutation runs without error.

The solution here is not the actual solution @VictoriaStudio is not right! all you have to do is get the actual Function ID that one that’s in the dev dashboard and in the toml file it’s UID, to get the actual ID use the query in the GraphiQL (Admin API) by pressing g in the terminal and run

`query GetFunctions {
shopifyFunctions(first: 10) {
nodes {
id
title
}
}
}
`
The id here is actual ID

1 Like

I just want to confirm that I deployed a custom app into a production site because I got lost a few times since in my sandbox store I was about to use functionHandle: "my-extension-handle" but in production this didn’t work.

For eg, you might find old instructions with this that is definitely obsolete.

discountAutomaticAppCreate(functionId:"abcdef123-1234-1234-1234-12345678990000") 

As of 2026-01, the instructions say to use the functionHandle:"my-extension-handle", but this will give you “Function not Found” if you are deploying to production. You can replace this with functionId and Graphiql will tell you this is deprecated, but it works.

I also confirm that ran these commands using the GraphiQL app. First use the instructions above to get your functionId.

query GetFunctions {
  shopifyFunctions(first: 10) {
    nodes {
      id
      title
    }
  }
}

Then run the mutation. Make sure [PRODUCT] matches what your function does, as dev is more lenient if you put [PRODUCT],[ORDER],[SHIPPING].

mutation {
  discountAutomaticAppCreate(
    automaticAppDiscount: {
      title: "Pricing Discount"
      functionId: "abcdef123-1234-1234-1234-12345678990000"
      discountClasses: [PRODUCT]
      startsAt: "2026-01-01T00:00:00"
    }
  ) {
    automaticAppDiscount {
      discountId
    }
    userErrors {
      field
      message
    }
  }
}