0

In GraphQL when I running below queries getting error.

Mutation :

mutation customerAccessTokenCreate {
 generateCustomerToken(
 email: "[email protected]",
 password: "Test@123"
 ) {
 token
 }
}
{
 customerCart {
 id
 items {
 id
 product {
 name
 sku
 }
 quantity
 }
 }
}

Query :

{
 cart(cart_id: "dmCaKmh6zzm4KDSMSOGGkS75sB071857") {
 email
 shipping_addresses {
 available_shipping_methods {
 amount {
 currency
 value
 }
 }
 } 
 }
}

Error :

{
 "messages": {
 "error": [
 {
 "code": 500,
 "message": "Fatal Error: 'Allowed memory size of 792723456 bytes exhausted (tried to allocate 67108872 bytes)' in '/var/www/html/m2/vendor/magento/zendframework1/library/Zend/Db/Select.php' on line 1004",
 "trace": "Trace is not available."
 }
 ]
 }
}
asked Jun 28, 2023 at 11:29
2

1 Answer 1

1

The above query are define in this file : vendor/magento/module-quote-graph-ql/etc/schema.graphqls

You need to debug this file code: vendor/magento/module-quote-graph-ql/Model/Resolver/ShippingAddress/AvailableShippingMethods.php

enter image description here

You need to check the code line by line. After debugging the code, you can find it. Otherwise please provide steps to reproduce the issue. In my case, All default queries and mutations are working fine. And If you did some customization, please share your code so I can check.

Note: The Customer Tokens are added on Header: https://magento.stackexchange.com/a/364509/82670

[Update Answer]

I created a customer's token using the below mutation.

enter image description here

Added customer token into header

enter image description here

Run customer cart query and get customer cart id.

enter image description here

I run a cart query to show available shipping methods. without product in the cart. It returns null.

enter image description here

Using the customer cart id I added one product to the cart.

enter image description here

After I run the cart query again and the shipping method is visible.

enter image description here

All queries and mutations are working well. All are tested on Magento 2.4.6-p1

Module List: app/etc/config.php

<?php
return [
 'modules' => [
 'Magento_Store' => 1,
 'Magento_Config' => 1,
 'Magento_AdminAnalytics' => 1,
 'Magento_AdminNotification' => 1,
 'Magento_AdobeIms' => 1,
 'Magento_AdobeImsApi' => 1,
 'Magento_AdobeStockAdminUi' => 1,
 'Magento_MediaGallery' => 1,
 'Magento_AdobeStockAssetApi' => 1,
 'Magento_AdobeStockClient' => 1,
 'Magento_AdobeStockClientApi' => 1,
 'Magento_AdobeStockImage' => 1,
 'Magento_Directory' => 1,
 'Magento_AdobeStockImageApi' => 1,
 'Magento_AdvancedPricingImportExport' => 1,
 'Magento_Theme' => 1,
 'Magento_Amqp' => 1,
 'Magento_Backend' => 1,
 'Magento_User' => 1,
 'Magento_Authorization' => 1,
 'Magento_Eav' => 1,
 'Magento_Customer' => 1,
 'Magento_AdminAdobeIms' => 1,
 'Magento_Backup' => 1,
 'Magento_Indexer' => 1,
 'Magento_GraphQl' => 1,
 'Magento_BundleImportExport' => 1,
 'Magento_Variable' => 1,
 'Magento_CacheInvalidate' => 1,
 'Magento_Cms' => 1,
 'Magento_Catalog' => 1,
 'Magento_Rule' => 1,
 'Magento_Security' => 1,
 'Magento_CmsGraphQl' => 1,
 'Magento_EavGraphQl' => 1,
 'Magento_Search' => 1,
 'Magento_CatalogImportExport' => 1,
 'Magento_CatalogRule' => 1,
 'Magento_CatalogInventory' => 1,
 'Magento_CatalogPageBuilderAnalytics' => 1,
 'Magento_CatalogSearch' => 1,
 'Magento_Msrp' => 1,
 'Magento_CatalogRuleGraphQl' => 1,
 'Magento_Quote' => 1,
 'Magento_Bundle' => 1,
 'Magento_SalesSequence' => 1,
 'Magento_CatalogUrlRewrite' => 1,
 'Magento_StoreGraphQl' => 1,
 'Magento_MediaStorage' => 1,
 'Magento_Payment' => 1,
 'Magento_Sales' => 1,
 'Magento_CheckoutAgreementsGraphQl' => 1,
 'Magento_MediaGalleryUi' => 1,
 'Magento_CatalogGraphQl' => 1,
 'Magento_CmsPageBuilderAnalytics' => 1,
 'Magento_Downloadable' => 1,
 'Magento_CmsUrlRewrite' => 1,
 'Magento_CmsUrlRewriteGraphQl' => 1,
 'Magento_CompareListGraphQl' => 1,
 'Magento_Integration' => 1,
 'Magento_Checkout' => 1,
 'Magento_UrlRewrite' => 1,
 'Magento_QuoteGraphQl' => 1,
 'Magento_ConfigurableProduct' => 1,
 'Magento_Tax' => 1,
 'Magento_Contact' => 1,
 'Magento_Cookie' => 1,
 'Magento_Cron' => 1,
 'Magento_Csp' => 1,
 'Magento_Widget' => 1,
 'Magento_Robots' => 1,
 'Magento_Analytics' => 1,
 'Magento_DownloadableGraphQl' => 1,
 'Magento_CustomerGraphQl' => 1,
 'Magento_CustomerImportExport' => 1,
 'Magento_SampleData' => 1,
 'Magento_Deploy' => 1,
 'Magento_Developer' => 1,
 'Magento_Dhl' => 1,
 'Magento_AdvancedSearch' => 1,
 'Magento_DirectoryGraphQl' => 1,
 'Magento_GroupedProduct' => 1,
 'Magento_CustomerDownloadableGraphQl' => 1,
 'Magento_ImportExport' => 1,
 'Magento_Weee' => 1,
 'Magento_CatalogSampleData' => 1,
 'Magento_CatalogCustomerGraphQl' => 1,
 'Magento_Elasticsearch' => 1,
 'Magento_Elasticsearch7' => 1,
 'Magento_Email' => 1,
 'Magento_EncryptionKey' => 1,
 'Magento_Fedex' => 1,
 'Magento_GiftMessage' => 1,
 'Magento_GiftMessageGraphQl' => 1,
 'Magento_GoogleAdwords' => 1,
 'Magento_GoogleAnalytics' => 1,
 'Magento_GoogleGtag' => 1,
 'Magento_Ui' => 1,
 'Magento_GoogleShoppingAds' => 1,
 'Magento_BundleGraphQl' => 1,
 'Magento_PageCache' => 1,
 'Magento_GroupedCatalogInventory' => 1,
 'Magento_GroupedImportExport' => 1,
 'Magento_BundleSampleData' => 1,
 'Magento_GroupedProductGraphQl' => 1,
 'Magento_CatalogRuleConfigurable' => 1,
 'Magento_DownloadableImportExport' => 1,
 'Magento_CardinalCommerce' => 1,
 'Magento_InstantPurchase' => 1,
 'Magento_CatalogAnalytics' => 1,
 'Magento_Inventory' => 1,
 'Magento_InventoryAdminUi' => 1,
 'Magento_InventoryAdvancedCheckout' => 1,
 'Magento_InventoryApi' => 1,
 'Magento_InventoryBundleImportExport' => 1,
 'Magento_InventoryBundleProduct' => 1,
 'Magento_InventoryBundleProductAdminUi' => 1,
 'Magento_InventoryBundleProductIndexer' => 1,
 'Magento_InventoryCatalog' => 1,
 'Magento_InventorySales' => 1,
 'Magento_InventoryCatalogAdminUi' => 1,
 'Magento_InventoryCatalogApi' => 1,
 'Magento_InventoryCatalogFrontendUi' => 1,
 'Magento_InventoryCatalogSearch' => 1,
 'Magento_InventoryCatalogSearchBundleProduct' => 1,
 'Magento_InventoryCatalogSearchConfigurableProduct' => 1,
 'Magento_ConfigurableProductGraphQl' => 1,
 'Magento_InventoryConfigurableProduct' => 1,
 'Magento_InventoryConfigurableProductFrontendUi' => 1,
 'Magento_InventoryConfigurableProductIndexer' => 1,
 'Magento_InventoryConfiguration' => 1,
 'Magento_InventoryConfigurationApi' => 1,
 'Magento_InventoryDistanceBasedSourceSelection' => 1,
 'Magento_InventoryDistanceBasedSourceSelectionAdminUi' => 1,
 'Magento_InventoryDistanceBasedSourceSelectionApi' => 1,
 'Magento_InventoryElasticsearch' => 1,
 'Magento_InventoryExportStockApi' => 1,
 'Magento_InventoryIndexer' => 1,
 'Magento_InventorySalesApi' => 1,
 'Magento_InventoryGroupedProduct' => 1,
 'Magento_InventoryGroupedProductAdminUi' => 1,
 'Magento_InventoryGroupedProductIndexer' => 1,
 'Magento_InventoryImportExport' => 1,
 'Magento_InventoryInStorePickupApi' => 1,
 'Magento_InventoryInStorePickupAdminUi' => 1,
 'Magento_InventorySourceSelectionApi' => 1,
 'Magento_InventoryInStorePickup' => 1,
 'Magento_InventoryInStorePickupGraphQl' => 1,
 'Magento_Shipping' => 1,
 'Magento_InventoryInStorePickupShippingApi' => 1,
 'Magento_InventoryInStorePickupQuoteGraphQl' => 1,
 'Magento_InventoryInStorePickupSales' => 1,
 'Magento_InventoryInStorePickupSalesApi' => 1,
 'Magento_InventoryInStorePickupQuote' => 1,
 'Magento_InventoryInStorePickupShipping' => 1,
 'Magento_InventoryInStorePickupShippingAdminUi' => 1,
 'Magento_Multishipping' => 1,
 'Magento_Webapi' => 1,
 'Magento_InventoryCache' => 1,
 'Magento_InventoryLowQuantityNotification' => 1,
 'Magento_Reports' => 1,
 'Magento_InventoryLowQuantityNotificationApi' => 1,
 'Magento_InventoryMultiDimensionalIndexerApi' => 1,
 'Magento_InventoryProductAlert' => 1,
 'Magento_InventoryQuoteGraphQl' => 1,
 'Magento_InventoryRequisitionList' => 1,
 'Magento_InventoryReservations' => 1,
 'Magento_InventoryReservationCli' => 1,
 'Magento_InventoryReservationsApi' => 1,
 'Magento_InventoryExportStock' => 1,
 'Magento_InventorySalesAdminUi' => 1,
 'Magento_CatalogInventoryGraphQl' => 1,
 'Magento_InventorySalesAsyncOrder' => 1,
 'Magento_InventorySalesFrontendUi' => 1,
 'Magento_InventorySetupFixtureGenerator' => 1,
 'Magento_InventoryShipping' => 1,
 'Magento_InventoryShippingAdminUi' => 1,
 'Magento_InventorySourceDeductionApi' => 1,
 'Magento_InventorySourceSelection' => 1,
 'Magento_InventoryInStorePickupFrontend' => 1,
 'Magento_InventorySwatchesFrontendUi' => 1,
 'Magento_InventoryVisualMerchandiser' => 1,
 'Magento_InventoryWishlist' => 1,
 'Magento_JwtFrameworkAdapter' => 1,
 'Magento_JwtUserToken' => 1,
 'Magento_LayeredNavigation' => 1,
 'Magento_LoginAsCustomer' => 1,
 'Magento_LoginAsCustomerAdminUi' => 1,
 'Magento_LoginAsCustomerApi' => 1,
 'Magento_LoginAsCustomerAssistance' => 1,
 'Magento_LoginAsCustomerFrontendUi' => 1,
 'Magento_LoginAsCustomerGraphQl' => 1,
 'Magento_LoginAsCustomerLog' => 1,
 'Magento_LoginAsCustomerPageCache' => 1,
 'Magento_LoginAsCustomerQuote' => 1,
 'Magento_LoginAsCustomerSales' => 1,
 'Magento_Marketplace' => 1,
 'Magento_MediaContent' => 1,
 'Magento_MediaContentApi' => 1,
 'Magento_MediaContentCatalog' => 1,
 'Magento_MediaContentCms' => 1,
 'Magento_MediaContentSynchronization' => 1,
 'Magento_MediaContentSynchronizationApi' => 1,
 'Magento_MediaContentSynchronizationCatalog' => 1,
 'Magento_MediaContentSynchronizationCms' => 1,
 'Magento_AdobeStockAsset' => 1,
 'Magento_MediaGalleryApi' => 1,
 'Magento_MediaGalleryCatalog' => 1,
 'Magento_MediaGalleryCatalogIntegration' => 1,
 'Magento_MediaGalleryCatalogUi' => 1,
 'Magento_MediaGalleryCmsUi' => 1,
 'Magento_MediaGalleryIntegration' => 1,
 'Magento_MediaGalleryMetadata' => 1,
 'Magento_MediaGalleryMetadataApi' => 1,
 'Magento_MediaGalleryRenditions' => 1,
 'Magento_MediaGalleryRenditionsApi' => 1,
 'Magento_MediaGallerySynchronization' => 1,
 'Magento_MediaGallerySynchronizationApi' => 1,
 'Magento_MediaGallerySynchronizationMetadata' => 1,
 'Magento_AdobeStockImageAdminUi' => 1,
 'Magento_MediaGalleryUiApi' => 1,
 'Magento_CatalogWidget' => 1,
 'Magento_MessageQueue' => 1,
 'Magento_GroupedProductSampleData' => 1,
 'Magento_MsrpConfigurableProduct' => 1,
 'Magento_MsrpGroupedProduct' => 1,
 'Magento_DownloadableSampleData' => 1,
 'Magento_InventoryInStorePickupMultishipping' => 1,
 'Magento_MysqlMq' => 1,
 'Magento_NewRelicReporting' => 1,
 'Magento_Newsletter' => 1,
 'Magento_NewsletterGraphQl' => 1,
 'Magento_OfflinePayments' => 1,
 'Magento_SalesRule' => 1,
 'Magento_OfflineShipping' => 1,
 'Magento_OpenSearch' => 1,
 'Magento_Sitemap' => 1,
 'Magento_PageBuilder' => 1,
 'Magento_PageBuilderAnalytics' => 1,
 'Magento_GraphQlCache' => 1,
 'Magento_ThemeSampleData' => 1,
 'Magento_PaymentGraphQl' => 1,
 'Magento_Vault' => 1,
 'Magento_Captcha' => 1,
 'Magento_Paypal' => 1,
 'Magento_Persistent' => 1,
 'Magento_ProductAlert' => 1,
 'Magento_ConfigurableSampleData' => 1,
 'Magento_ProductVideo' => 1,
 'Magento_ConfigurableImportExport' => 1,
 'Magento_QuoteAnalytics' => 1,
 'Magento_QuoteBundleOptions' => 1,
 'Magento_QuoteConfigurableOptions' => 1,
 'Magento_QuoteDownloadableLinks' => 1,
 'Magento_InventoryConfigurableProductAdminUi' => 1,
 'Magento_ReCaptchaAdminUi' => 1,
 'Magento_ReCaptchaCheckout' => 1,
 'Magento_ReCaptchaCheckoutSalesRule' => 1,
 'Magento_ReCaptchaContact' => 1,
 'Magento_ReCaptchaCustomer' => 1,
 'Magento_ReCaptchaFrontendUi' => 1,
 'Magento_ReCaptchaMigration' => 1,
 'Magento_ReCaptchaNewsletter' => 1,
 'Magento_ReCaptchaPaypal' => 1,
 'Magento_ReCaptchaReview' => 1,
 'Magento_ReCaptchaSendFriend' => 1,
 'Magento_ReCaptchaStorePickup' => 1,
 'Magento_ReCaptchaUi' => 1,
 'Magento_ReCaptchaUser' => 1,
 'Magento_ReCaptchaValidation' => 1,
 'Magento_ReCaptchaValidationApi' => 1,
 'Magento_ReCaptchaVersion2Checkbox' => 1,
 'Magento_ReCaptchaVersion2Invisible' => 1,
 'Magento_ReCaptchaVersion3Invisible' => 1,
 'Magento_ReCaptchaWebapiApi' => 1,
 'Magento_ReCaptchaWebapiGraphQl' => 1,
 'Magento_ReCaptchaWebapiRest' => 1,
 'Magento_ReCaptchaWebapiUi' => 1,
 'Magento_RelatedProductGraphQl' => 1,
 'Magento_ReleaseNotification' => 1,
 'Magento_RemoteStorage' => 1,
 'Magento_InventoryLowQuantityNotificationAdminUi' => 1,
 'Magento_RequireJs' => 1,
 'Magento_Review' => 1,
 'Magento_ReviewAnalytics' => 1,
 'Magento_ReviewGraphQl' => 1,
 'Magento_ReviewSampleData' => 1,
 'Magento_AwsS3' => 1,
 'Magento_Rss' => 1,
 'Magento_PageBuilderAdminAnalytics' => 1,
 'Magento_PaypalCaptcha' => 1,
 'Magento_SalesAnalytics' => 1,
 'Magento_SalesGraphQl' => 1,
 'Magento_SalesInventory' => 1,
 'Magento_OfflineShippingSampleData' => 1,
 'Magento_CatalogRuleSampleData' => 1,
 'Magento_TaxSampleData' => 1,
 'Magento_CheckoutAgreements' => 1,
 'Magento_SalesRuleSampleData' => 1,
 'Magento_UrlRewriteGraphQl' => 1,
 'Magento_CustomerAnalytics' => 1,
 'Magento_Securitytxt' => 1,
 'Magento_SendFriend' => 1,
 'Magento_SendFriendGraphQl' => 1,
 'Magento_InventoryInStorePickupSalesAdminUi' => 1,
 'Magento_AwsS3PageBuilder' => 1,
 'Magento_InventoryGraphQl' => 1,
 'Magento_CatalogCmsGraphQl' => 1,
 'Magento_Swagger' => 1,
 'Magento_SwaggerWebapi' => 1,
 'Magento_SwaggerWebapiAsync' => 1,
 'Magento_Swatches' => 1,
 'Magento_SwatchesGraphQl' => 1,
 'Magento_SwatchesLayeredNavigation' => 1,
 'Magento_SwatchesSampleData' => 1,
 'Magento_MsrpSampleData' => 1,
 'Magento_TaxGraphQl' => 1,
 'Magento_TaxImportExport' => 1,
 'Magento_CustomerSampleData' => 1,
 'Magento_TwoFactorAuth' => 0,
 'Magento_ThemeGraphQl' => 1,
 'Magento_CmsSampleData' => 1,
 'Magento_Translation' => 1,
 'Magento_AdminAdobeImsTwoFactorAuth' => 0,
 'Magento_GoogleOptimizer' => 1,
 'Magento_Ups' => 1,
 'Magento_SalesSampleData' => 1,
 'Magento_CatalogUrlRewriteGraphQl' => 1,
 'Magento_AsynchronousOperations' => 1,
 'Magento_Usps' => 1,
 'Magento_ConfigurableProductSales' => 1,
 'Magento_PaypalGraphQl' => 1,
 'Magento_VaultGraphQl' => 1,
 'Magento_Version' => 1,
 'Magento_InventoryInStorePickupWebapiExtension' => 1,
 'Magento_WebapiAsync' => 1,
 'Magento_WebapiSecurity' => 1,
 'Magento_ProductLinksSampleData' => 1,
 'Magento_WeeeGraphQl' => 1,
 'Magento_CurrencySymbol' => 1,
 'Magento_WidgetSampleData' => 1,
 'Magento_Wishlist' => 1,
 'Magento_WishlistAnalytics' => 1,
 'Magento_WishlistGraphQl' => 1,
 'Magento_WishlistSampleData' => 1,
 'PayPal_Braintree' => 1,
 'PayPal_BraintreeGraphQl' => 1,
 'Temando_ShippingRemover' => 1
 ]
];
answered Jun 28, 2023 at 20:17
11
  • Can you check in fresh instance, I am getting error in fresh instance also. Commented Jun 30, 2023 at 6:12
  • please provide the steps to reproduce it and which magento version are using. Commented Jun 30, 2023 at 7:04
  • 1. First Get Customer Token, 2 Next Pass Authorization Bearer Token in Customer Cart 3. Pass Authorization Bearer Token and id in Third Query (Cart Query) . Commented Jun 30, 2023 at 7:30
  • Please Update your question with steps. and also provide which magento version are using. Is there any third-party module or not? Commented Jun 30, 2023 at 7:40
  • 1
    I will install and update you. Commented Jun 30, 2023 at 13:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.