Main issue: discountAutomaticAppCreate returns âFunction not foundâ or server errors when called outside the app template (e.g., via Postman) or on production stores.
Key clarifications:
An app can only reference its own Functions. The Admin API token used must belong to the same app that owns the functionId.
Use an offline Admin API access token (non-expiring OAuth token) for that same app when calling discountAutomaticAppCreate. Ensure required scopes (e.g., write_discounts).
Development vs production:
Several reports: works on development stores but fails on production (either âfunction not foundâ or INTERNAL_SERVER_ERROR).
Guidance indicates Functions in custom/singleâshop apps require a Shopify Plus subscription on the target shop. NonâPlus production shops may fail even if development works. One user notes cartâvalidation functions work; discount Functions may have stricter requirements.
Actionable steps:
Verify the token is an offline token issued to the same app as the function.
Confirm the target storeâs plan supports custom app Functions (Plus for discounts).
Status/open items:
How to obtain the offline token is referenced via OAuth docs; no stepâbyâstep in thread.
Internal server error on production remains unresolved beyond plan requirement guidance.
Summarized with AI on December 18.
AI used: gpt-5.
I am creating discount app and using Shopify Functions Product Discount API to create discounts. I have used this template ( https://github.com/Shopify/function-examples/tree/main/sample-apps/discounts-tutorial ). It works well and created the app with product discounts extension. To create a discount itself it uses admin GraphQL API with discountAutomaticAppCreate mutation. All works when creating discounts from the app template. However, when I try to send the same request from Postman I am getting the following error:
It looks like API does not see my function. I checked the functionId, itâs correct.
I want to change the project template to a custom one, because of inconvenience and other problems. That is why I cannot continue using this template.
P.S. I tried to send the request from another appâs backend (working app) and received the same error.
All requests are done to the store with checkout extensibility preview.
Currently an app can only reference its own functions. That is, when invoking discountAutomaticAppCreate, the API Key used must belong to the same app as the function.
In the case of Postman then, be sure you are using an offline access token for the same app.
I have the same problem when i try save a order discount, my app works fine in development store but i dont understand why when install on production store i get âautomaticAppDiscount.functionId Function not foundâ, i tried create others apps and in development store works great but on production I get the same error.
I am installing the app to production by install link.
The SHOPIFY_API_KEY is correct.
My question is: what do i have to do for my app works fine on production store.
@RickyMagana This may also indicate that you are attempting to use a custom app with a non-Plus shop. Functions can only be used in custom/single-shop apps with a Plus subscription.
When I move it to the production store, running the GraphiQL query to retrieve the functions in step 4, does not return the function, even though it is installed.
Using this access token, I can now run a graphql, which lists out the function correctly, but when I try to add the discountAutomaticAppCreate via graphql using the same access token, it returns âfunction not foundâ.
The token has write_discounts scope.
Any idea what Iâm doing wrong?
Does the store need to be on a PLUS plan for this to work?
âFunctions can only be used in custom/single-shop apps with a Plus subscriptionâ
This kind of suggests that they do, but I have other (cart-validation) functions working with a single shop/custom setup�??
mutation {
discountAutomaticAppCreate(automaticAppDiscount:{
startsAt: â2024-09-25â,
title: âOrder Discountâ,
functionId: â4e215005-26ae-486b-b310-54827cdd4cf7â
}) {
automaticAppDiscount {
discountId
}
userErrors {
code
message
}
}
}
This function works in my development test store and I get an internal server error in the production area. I wonder if the Order Discount Function is available only for Shopify Plus subscribers.
Here is the error I encountered during this mutation operation :
{
âerrorsâ: [
{
âmessageâ: âInternal error. Looks like something went wrong on our end.\nRequest ID: 690f9175-1aaf-4b24-8caf-5c79c7a2ff72-1727308714 (include this in support requests).â,
âextensionsâ: {
âcodeâ: âINTERNAL_SERVER_ERRORâ,
ârequestIdâ: â690f9175-1aaf-4b24-8caf-5c79c7a2ff72-1727308714â
}
}
]
}