magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Internal server error while getting a category that contains grouped products without child products

Open rdk-pmis opened this issue 1 year ago • 7 comments

Preconditions and environment

  • Magento 2.4.7
  • 2 websites

Steps to reproduce

Make sure that there are simple products that aren't linked to the second website. Now create a grouped product in the default store view, link this to both store views and add child products that are only linked to the first website Link the product to categories of both websites. Add simple products to the same categories. Now query the category using graphql and set the value for store in the headers to the code of a store view from the second website Now do the following query (replace the value of category_id with the id of the category from the second website you've chosen for your grouped product:

{ products(pageSize: 12 currentPage: 1 filter: {category_id: {eq: "42"} } ) { total_count page_info { page_size current_page total_pages } aggregations {  attribute_code count label options { count label value } }  items { sku description {html} price_range{maximum_price {
    discount {
      amount_off
      percent_off
    }
    final_price {
      currency
      value
    }
    fixed_product_taxes {
      amount {currency value}
      label
    }
    regular_price {
      currency
      value
    }
  }minimum_price {
    discount {
      amount_off
      percent_off
    }
    final_price {
      currency
      value
    }
    fixed_product_taxes {
      amount{currency value}
      label
    }
    regular_price {
      currency
      value
    }
  }}}}}

Result is an internal server error in the errors section When I check the exception log I get: {"exception":"[object] (GraphQL\\Error\\Error(code: 0): Warning: Trying to access array offset on value of type null in /app/vendor/magento/module-grouped-product-graph-ql/Model/Resolver/Product/Price/Provider.php on line 95 at /app/vendor/webonyx/graphql-php/src/Error/Error.php:155) [previous exception] [object] (Exception(code: 0): Warning: Trying to access array offset on value of type null in /app/vendor/magento/module-grouped-product-graph-ql/Model/Resolver/Product/Price/Provider.php on line 95 at /app/vendor/magento/framework/App/ErrorHandler.php:62)"}

Expected result

No errors

Actual result

{
  "errors": [
    {
      "message": "Internal server error",
      "locations": [
        {
          "line": 1,
          "column": 247
        }
      ],
      "path": [
        "products",
        "items",
        0,
        "price_range"
      ]
    }
  ],
  "data": {
    "products": {
      "total_count": 4,
      "page_info": {
        "page_size": 12,
        "current_page": 1,
        "total_pages": 1
      },
      "aggregations": [
        {
          "attribute_code": "price",
          "count": 2,
          "label": "Price",
          "options": [
            {
              "count": 2,
              "label": "40-50",
              "value": "40_50"
            },
            {
              "count": 1,
              "label": "50-60",
              "value": "50_60"
            }
          ]
        },
        {
          "attribute_code": "category_uid",
          "count": 1,
          "label": "Category",
          "options": [
            {
              "count": 4,
              "label": "Child",
              "value": "NDI="
            }
          ]
        },
        {
          "attribute_code": "activity",
          "count": 12,
          "label": "Activity",
          "options": [
            {
              "count": 1,
              "label": "Outdoor",
              "value": "5"
            },
            {
              "count": 1,
              "label": "Yoga",
              "value": "8"
            },
            {
              "count": 3,
              "label": "Recreation",
              "value": "9"
            },
            {
              "count": 2,
              "label": "Gym",
              "value": "11"
            },
            {
              "count": 1,
              "label": "Athletic",
              "value": "16"
            },
            {
              "count": 1,
              "label": "Sports",
              "value": "17"
            },
            {
              "count": 1,
              "label": "Hiking",
              "value": "18"
            },
            {
              "count": 1,
              "label": "Overnight",
              "value": "19"
            },
            {
              "count": 1,
              "label": "School",
              "value": "20"
            },
            {
              "count": 1,
              "label": "Trail",
              "value": "21"
            },
            {
              "count": 1,
              "label": "Travel",
              "value": "22"
            },
            {
              "count": 1,
              "label": "Urban",
              "value": "23"
            }
          ]
        },
        {
          "attribute_code": "category_gear",
          "count": 4,
          "label": "Category Gear",
          "options": [
            {
              "count": 3,
              "label": "Electronic",
              "value": "86"
            },
            {
              "count": 2,
              "label": "Exercise",
              "value": "87"
            },
            {
              "count": 1,
              "label": "Fashion",
              "value": "88"
            },
            {
              "count": 3,
              "label": "Timepiece",
              "value": "90"
            }
          ]
        },
        {
          "attribute_code": "eco_collection",
          "count": 1,
          "label": "Eco Collection",
          "options": [
            {
              "count": 2,
              "label": "No",
              "value": "0"
            }
          ]
        },
        {
          "attribute_code": "erin_recommends",
          "count": 2,
          "label": "Erin Recommends",
          "options": [
            {
              "count": 2,
              "label": "No",
              "value": "0"
            },
            {
              "count": 1,
              "label": "Yes",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "features_bags",
          "count": 8,
          "label": "Features",
          "options": [
            {
              "count": 1,
              "label": "Hydration Pocket",
              "value": "71"
            },
            {
              "count": 1,
              "label": "Audio Pocket",
              "value": "72"
            },
            {
              "count": 1,
              "label": "Flapover",
              "value": "73"
            },
            {
              "count": 1,
              "label": "Waterproof",
              "value": "74"
            },
            {
              "count": 1,
              "label": "Lightweight",
              "value": "75"
            },
            {
              "count": 1,
              "label": "Reflective",
              "value": "77"
            },
            {
              "count": 1,
              "label": "Laptop Sleeve",
              "value": "78"
            },
            {
              "count": 1,
              "label": "Lockable",
              "value": "79"
            }
          ]
        },
        {
          "attribute_code": "gender",
          "count": 2,
          "label": "Gender",
          "options": [
            {
              "count": 0,
              "label": "Male",
              "value": "1"
            },
            {
              "count": 3,
              "label": "Women",
              "value": "81"
            }
          ]
        },
        {
          "attribute_code": "material",
          "count": 12,
          "label": "Material",
          "options": [
            {
              "count": 1,
              "label": "Burlap",
              "value": "31"
            },
            {
              "count": 1,
              "label": "Canvas",
              "value": "32"
            },
            {
              "count": 1,
              "label": "Cotton",
              "value": "33"
            },
            {
              "count": 1,
              "label": "Leather",
              "value": "35"
            },
            {
              "count": 1,
              "label": "Mesh",
              "value": "36"
            },
            {
              "count": 1,
              "label": "Nylon",
              "value": "37"
            },
            {
              "count": 1,
              "label": "Polyester",
              "value": "38"
            },
            {
              "count": 1,
              "label": "Suede",
              "value": "41"
            },
            {
              "count": 1,
              "label": "Plastic",
              "value": "44"
            },
            {
              "count": 1,
              "label": "Rubber",
              "value": "45"
            },
            {
              "count": 1,
              "label": "Stainless Steel",
              "value": "47"
            },
            {
              "count": 2,
              "label": "Silicone",
              "value": "48"
            }
          ]
        },
        {
          "attribute_code": "new",
          "count": 2,
          "label": "New",
          "options": [
            {
              "count": 2,
              "label": "No",
              "value": "0"
            },
            {
              "count": 1,
              "label": "Yes",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "performance_fabric",
          "count": 1,
          "label": "Performance Fabric",
          "options": [
            {
              "count": 2,
              "label": "No",
              "value": "0"
            }
          ]
        },
        {
          "attribute_code": "sale",
          "count": 2,
          "label": "Sale",
          "options": [
            {
              "count": 2,
              "label": "No",
              "value": "0"
            },
            {
              "count": 3,
              "label": "Yes",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "strap_bags",
          "count": 7,
          "label": "Strap/Handle",
          "options": [
            {
              "count": 1,
              "label": "Adjustable",
              "value": "61"
            },
            {
              "count": 1,
              "label": "Cross Body",
              "value": "62"
            },
            {
              "count": 1,
              "label": "Detachable",
              "value": "63"
            },
            {
              "count": 1,
              "label": "Double",
              "value": "64"
            },
            {
              "count": 1,
              "label": "Padded",
              "value": "65"
            },
            {
              "count": 1,
              "label": "Shoulder",
              "value": "66"
            },
            {
              "count": 1,
              "label": "Single",
              "value": "67"
            }
          ]
        },
        {
          "attribute_code": "style_bags",
          "count": 5,
          "label": "Style Bags",
          "options": [
            {
              "count": 1,
              "label": "Backpack",
              "value": "24"
            },
            {
              "count": 1,
              "label": "Messenger",
              "value": "27"
            },
            {
              "count": 1,
              "label": "Laptop",
              "value": "28"
            },
            {
              "count": 1,
              "label": "Exercise",
              "value": "29"
            },
            {
              "count": 1,
              "label": "Tote",
              "value": "30"
            }
          ]
        }
      ],
      "items": [
        null,
        {
          "sku": "24-WG03",
          "description": {
            "html": "<p>Keep track of time on the treadmill or trail with our Clamber Watch. The flexible, rubberized strap is contoured to conform to your wrist for a comfortable fit all day. The face features an illuminated digital read-out of the current time and stopwatch functions.</p>\r\n<ul>\r\n<li>Japanese quartz movement.</li>\r\n<li>Strap fits 5\" to 6.0\".</li>\r\n</ul>"
          },
          "price_range": {
            "maximum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "currency": "EUR",
                "value": 54
              },
              "fixed_product_taxes": [],
              "regular_price": {
                "currency": "EUR",
                "value": 54
              }
            },
            "minimum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "currency": "EUR",
                "value": 54
              },
              "fixed_product_taxes": [],
              "regular_price": {
                "currency": "EUR",
                "value": 54
              }
            }
          }
        },
        {
          "sku": "24-WG01",
          "description": {
            "html": "<p>The Bolo Sport Watch is sleek, sporty and sized just right to fit your smaller wrist. Easy to read and set up, it features a large digital face and button-activated alarm and stopwatch. The soft-touch resin band promises no-pinch comfort, while the water-resistant design lets you take your workout to the lap pool.</p>\n<ul>\n<li>Displays time, day and date.</li>\n<li>Two-tone design.</li>\n<li>12/24 hour formats.</li>\n<li>Nickel-free buckle on band.</li>\n<li>Battery included.</li>\n</ul>"
          },
          "price_range": {
            "maximum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "currency": "EUR",
                "value": 49
              },
              "fixed_product_taxes": [],
              "regular_price": {
                "currency": "EUR",
                "value": 49
              }
            },
            "minimum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "currency": "EUR",
                "value": 49
              },
              "fixed_product_taxes": [],
              "regular_price": {
                "currency": "EUR",
                "value": 49
              }
            }
          }
        },
        {
          "sku": "24-WG09",
          "description": {
            "html": "<p>Designed to stand up to your active lifestyle, this women's Luma Analog Watch features a tasteful brushed chrome finish and a stainless steel, water-resistant construction for lasting durability.</p>\n<ul>\n<li>Precision Miyota&reg; three-hand movement.</li>\n</ul>"
          },
          "price_range": {
            "maximum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "currency": "EUR",
                "value": 43
              },
              "fixed_product_taxes": [],
              "regular_price": {
                "currency": "EUR",
                "value": 43
              }
            },
            "minimum_price": {
              "discount": {
                "amount_off": 0,
                "percent_off": 0
              },
              "final_price": {
                "currency": "EUR",
                "value": 43
              },
              "fixed_product_taxes": [],
              "regular_price": {
                "currency": "EUR",
                "value": 43
              }
            }
          }
        }
      ]
    }
  }
}

Additional information

name : magento/module-grouped-product-graph-ql descrip. : N/A keywords : versions : * 100.4.7 type : magento2-module license : Open Software License 3.0 (OSL-3.0) (OSI approved) https://spdx.org/licenses/OSL-3.0.html#licenseText license : Academic Free License v3.0 (AFL-3.0) (OSI approved) https://spdx.org/licenses/AFL-3.0.html#licenseText homepage : source : []
dist : [zip] https://repo.magento.com/archives/magento/module-grouped-product-graph-ql/magento-module-grouped-product-graph-ql-100.4.7.0.zip path : /media/disk2/dev/magento2/magento24/src/vendor/magento/module-grouped-product-graph-ql names : magento/module-grouped-product-graph-ql

autoload files psr-4 Magento\GroupedProductGraphQl\ => .

requires magento/framework 103.0.* magento/module-catalog 104.0.* magento/module-catalog-graph-ql 100.4.* magento/module-grouped-product 100.4.* php ~8.1.0||~8.2.0||~8.3.0

Default storeview image

view 2 image

Category: image

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.
  • [X] 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”.

rdk-pmis avatar Apr 25 '24 14:04 rdk-pmis

Hi @rdk-pmis. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar Apr 25 '24 14:04 m2-assistant[bot]

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Apr 25 '24 14:04 m2-assistant[bot]

@magento give me 2.4-develop instance

engcom-Delta avatar May 10 '24 13:05 engcom-Delta

Hi @engcom-Delta. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Delta, here is your Magento Instance: https://4aa86b70ffcff9afc88ee121b9e65060.instances-prod.magento-community.engineering Admin access: https://4aa86b70ffcff9afc88ee121b9e65060.instances-prod.magento-community.engineering/admin_daab Login: 6bff81b6 Password: 2aee3fd01226

Hi @rdk-pmis,

Verified the issue on 2.4-develop and 2.4.7 and it is not reproducible.

Steps to reproduce:-

1.Make sure that there are simple products that aren't linked to the second website. 2.Now create a grouped product in the default store view, link this to both store views and add child products that are only linked to the first website 3.Link the product to categories of both websites. 4.Add simple products to the same categories. 5.Now query the category using graphql and set the value for store in the headers to the code of a store view from the second website 6.Now do the following query (replace the value of category_id with the id of the category from the second website you've chosen for your grouped product:

Please refer the attached screenshot and let us if we are missing something.

Multiple website created other than default like test1

Screenshot 2024-05-10 at 9 33 32 PM

Grouped product created in default store view

Screenshot 2024-05-10 at 9 34 00 PM

Child products are added which are only in default website

Screenshot 2024-05-10 at 9 34 16 PM

Grouped product added to all websites

Screenshot 2024-05-10 at 9 34 25 PM

Products in the category

Screenshot 2024-05-10 at 9 36 23 PM

hit the given graphql query and no internal server error recorded

Screenshot 2024-05-10 at 9 36 52 PM

engcom-Delta avatar May 10 '24 16:05 engcom-Delta

Hi @rdk-pmis,

Awaiting your reply on this issue to move further.

Thanks,

engcom-Delta avatar May 21 '24 07:05 engcom-Delta

Hello @rdk-pmis ,

As there is no activity on this issue for a long time, we believe the issue has been resolved, hence closing this issue. Feel free to raise a new issue or reopen this if you need more assistance.

Thanks,

engcom-Delta avatar Jun 06 '24 09:06 engcom-Delta