magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

Internal Server Error in /V1/order/{orderId}/ship API Endpoint #35931

Open mlf20 opened 2 years ago

mlf20 commented 2 years ago

Preconditions and environment

Steps to reproduce

  1. Retrieve auth token from the admin endpoint /V1/integration/admin/
  2. Request endpoint: POST : //yourstore/rest/V1/order/{orderId}/ship Payload: { "items": "[]" }

Other below APi's also got effected and getting similar error in logs:

  1. POST request to /V1/inventory/stock-source-links with payload: {"links": "[]"}
  2. POST request to /rest/V1/inventory/source-items with payload: {"sourceItems": "\[]\"}
  3. POST request to //V1/inventory/low-quantity-notification with payload: {"sourceItemConfigurations": ""}
  4. POST request to /rest/V1/inventory/stock-source-links-delete with payload: {"links": "\[]\"}

Expected result

Returns a 400 error as the request is malformed.

Actual result

Returns a 500 status code from a null TypeError .

Additional information

output of var/log/system.log:

    [2022-08-01T12:54:49.463557+00:00] main.CRITICAL: TypeError: Magento\Sales\Model\ShipOrder::execute(): Argument #2 ($items) must be of type array, null given in /magento/vendor/magento/module-sales/Model/ShipOrder.php:133
    Stack trace:
    #0 [internal function]: Magento\Sales\Model\ShipOrder->execute()
    #1 /magento/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array()
    #2 /magento/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process()
    #3 /magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch()
    #4 /magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent()
    #5 /magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}()
    #6 /magento/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins()
    #7 /magento/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch()
    #8 /magento/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
    #9 /magento/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
    #10 /magento/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
    #11 {main} [] []

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 years ago

Hi @mlf20. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

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:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


: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.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-November. 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:

engcom-November commented 2 years ago

Hi @mlf20 , Thank you for reporting and collaboration. This issue is not reproducible on 2.4-develop branch The exception mentioned in all the below issues reported by you is the similar error/ issue which is not reproducible on 2.4-develop branch. Can we close all the other issues and track in a single bug: https://github.com/magento/magento2/issues/35934 Similar issues having same kind of exception: https://github.com/magento/magento2/issues/35929 https://github.com/magento/magento2/issues/35928 https://github.com/magento/magento2/issues/35927 https://github.com/magento/magento2/issues/35926 https://github.com/magento/magento2/issues/35931 https://github.com/magento/magento2/issues/35930

We are getting a 400 error as the request is malformed. Kindly check Magento system requirements and 3rd party exntensions / modules enabled is causing this issue. Kindly recheck the issue on Magento 2.4-develop branch and provide missing steps if any if you are still facing any issues. Thank you

mlf20 commented 2 years ago

Hi @engcom-November

I have gone over my logs and the payload in the body should be '{}'

This reproduces the issue on Magento 2.4-dev as shown below: Screenshot 2022-08-12 at 16 31 41

engcom-November commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

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

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-November, here is your Magento Instance: https://64d98f06e55e370be8728bd1aee78bb0.instances.magento-community.engineering Admin access: https://64d98f06e55e370be8728bd1aee78bb0.instances.magento-community.engineering/admin_0ae1 Login: 55ee1fc2 Password: 149b20bb8020

engcom-November commented 2 years ago

Verified the issue on Magento 2.4-develop branch and the issue is reproducible. Hence updating the description and confirming the issue image

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-6420 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @AmyJZhao. Thank you for verifying the issue.
Issue Available: @AmyJZhao, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Alexander-Khohklov commented 11 months ago

@magento I am working on this

Monica8955 commented 7 months ago

any news of this request? i have the same issue for magento 2.4.6-p2