Open
Description
Preconditions and environment
Magento 2.4.8
Steps to reproduce
- Create a simple product, customer, sales rule with a coupon, and place an order using this customer and applying coupon.
- Get customer token via GraphQL query generateCustomerToken
- Issue GraphQL request
query {
customer {
firstname
lastname
orders {
items {
order_number
status
items {
product_sku
discounts {
applied_to
amount {
value
}
}
}
}
page_info {
current_page
page_size
total_pages
}
total_count
}
}
}
Expected result
There is a correct response from GraphQl with orders and order items discount data
Actual result
There is an error: Internal server error Cannot return null for non-nullable field "Discount.applied_to"
exception.log:
[2025-06-05T10:18:09.817671+00:00] main.ERROR: Cannot return null for non-nullable field "Discount.applied_to".
GraphQL (25:13)
24: discounts {
25: applied_to
^
26: amount {
{"exception":"[object] (GraphQL\\Error\\Error(code: 0): Cannot return null for non-nullable field \"Discount.applied_to\". at /home/zak/sites/magento/test1/public/vendor/webonyx/graphql-php/src/Error/Error.php:171)
[previous exception] [object] (GraphQL\\Error\\InvariantViolation(code: 0): Cannot return null for non-nullable field \"Discount.applied_to\". at /home/zak/sites/magento/test1/public/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php:899)"} []
Additional information
Related issues
- Error getting order item coupon code for customer order via GraphQl customer request #39962
- Cannot return null for non-nullable field \"AppliedCoupon.code\" unexpected issue #39841
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Ready for Development