Fagborg
Fagborg

Reputation: 1

"Error 400: Bad Request" when Uploading Images to Azure Custom Vision via Azure Logic App

I am encountering a "400: Bad Request" error when attempting to upload images to Azure Custom Vision using an Azure Logic App. This process works perfectly in Postman, but consistently fails in the Logic App. I've tried various image sizes and ensured that the headers in Logic App match those in Postman as closely as possible. The goal is to integrate Azure Blob Storage to process images through Custom Vision and then parse and index the results.

The goal: The goal is to make my workflow interact with Azure Blob Storage, process images through Custom Vision (object detection), and then parse and index the results.

**Here is the input from the HTML Request: ** { "uri": "https://anonymized-prediction.cognitiveservices./customvision/v3.0/Prediction//detect/iterations/Iteration1/image", "method": "POST", "headers": { "Content-Type": "application/octet-stream", "Prediction-Key": "", "x-ms-region": "anonymized", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive" }, "body": { "$content-type": "image/png", "$content": "anonymized" } }

**And the output: **

{ "statusCode": 400, "headers": { "request-id": "anonymized", "x-envoy-upstream-service-time": "anonymized", "apim-request-id": "anonymized", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", "x-ms-region": "anonymized", "Date": "anonymized", "Content-Length": "anonymized", "Content-Type": "application/json; charset=utf-8" }, "body": { "code": "BadRequestImageStream", "message": "Bad Request Image Stream (stream is empty), Uri: anonymized" } }

I've tried using different image sizes, including very small images. Ensuring headers in the Logic App match those in Postman (where possible). Manually verifying the base64 encoded image strings. Double-checking the API endpoint and authentication details.

Expected Outcome: I expected the images to upload successfully as they do in Postman, allowing the workflow to process and analyze the images without errors.

Upvotes: -1

Views: 120

Answers (1)

Fagborg
Fagborg

Reputation: 1

There are hidden headers in postman. I added them to my logic app http request, and it worked.

Upvotes: 0

Related Questions