microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
732 stars 243 forks source link

Issue creating a purchase invoice using batch requests on OData REST webservices - Sandbox environment crashing #6386

Closed ricardopaiva closed 3 years ago

ricardopaiva commented 3 years ago

Describe the bug When trying to create a purchase invoice using the batch request to a OData endpoint, I get a 500 Internal Server Error. This is happening in the Sandbox and Trial Cloud Environments but not on Onprem/Sandbox on Docker environments.

To Reproduce Steps to reproduce the behavior: Please note that I'm using Postman to create the requests. (See screenshot 1)

  1. Create a new POST request to the url: https://api.businesscentral.dynamics.com/v2.0/tenant id/sandbox/api/v1.0/$batch
  2. Setup authentication
  3. Change the body to raw (JSON) and paste the following: { "requests": [ { "method": "POST", "url": "purchaseInvoices", "headers": { "Company": "CRONUS USA, Inc.", "Content-Type": "application/json" }, "body": { "invoiceDate": "2020-05-01", "postingDate": "2020-05-01", "dueDate": "2020-05-31", "vendorInvoiceNumber": "VENDOR INV. NO. 107211", "vendorId": "dc50b2a7-7da4-ea11-bb8b-000d3a38e224", "vendorNumber": "30000", "payToVendorNumber": "30000", "purchaseInvoiceLines": [ { "sequence": 10000, "lineType": "Item", "itemId": "dc50b2a7-7da4-ea11-bb8b-000d3a38e224", "description": "ATHENS Desk (Changed description)", "unitCost": 338, "quantity": 5 } ] } } ] }

Don't forget to update the vendorId and itemId to match yours.

  1. Send the request.

Besides the error, if I try to access the Business Central environment, I have an error (see screenshot 2). It seems like the request is also crashing the BC instance (and that's why I get the 500 Internal Server Error).

Expected behavior I've done the same test on V16 Onprem and Sandbox environments on Docker and the behavior was the expected. I've receive a 200 OK response and the purchase invoice was successfully inserted in BC. (See screenshot 3)

Screenshots Screenshot 1: image

Screenshot 2: image

Screenshot 3: image

5. Versions: Business Central: Version: US Business Central 17.2 (Platform 17.0.19353.19941 + Application 17.2.19367.19525)

atoader commented 3 years ago

Hi! This issue concerns a production system. This repository is only for issues related to the AL compiler and developer tools of the latest developer preview environment for Dynamics 365 Business Central and we cannot guarantee a timely resolution of your issue. We suggest that you open a support case and work with our customer support team to gather all the information necessary to fix this problem.
Please read this post on how to file an issue: https://cloudblogs.microsoft.com/dynamics365/it/2019/09/25/new-process-to-submit-support-requests-for-dynamics-365-business-central/