amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
609 stars 732 forks source link

Fulfillment Inbound API v2024-03-20. CreateInboundPlan address validation fails without any meaningfull error #4106

Closed emakunin closed 1 month ago

emakunin commented 2 months ago

Hello,

I'm using CreateInboundPlan operation however for certain addressed it fails with a cryptic validation error. It is impossible to understand what and why is not valid. Even for the addresses that are totally fine from other validation services perspective.

Could you please provide details of what is wrong/missed? Given that most of the fields are optional it's hard to guess/validate what is needed as an input

Example

Request

{
  "destinationMarketplaces": [
    "A1PA6795UKMFR9"
  ],
  "items": [
     ...
  ],
  "name": "5OD-TXZ",
  "sourceAddress": {
    "addressLine1": "*** ",
    "addressLine2": null,
    "city": "Ghaziabad",
    "companyName": "***",
    "countryCode": "IN",
    "email": "***@***.in",
    "name": "Jeff Besos",
    "phoneNumber": "+91773*******",
    "postalCode": "201007",
    "stateOrProvinceCode": null
  }
}

Output

{
  "errors": [
    {
      "code": "BadRequest",
      "message": "ERROR: Provided address is invalid. Please correct the address and try again.",
      "details": ""
    }
  ]
}
mafge commented 2 months ago

Hi @emakunin, thanks for reaching out! Please have a look at the docs to identify required address fields. There are also length constraints for each field so make sure to comply with them. Hope that helps! Best, Marc Selling Partner Developer Services

emakunin commented 2 months ago

Hi @mafge the document you refer to is not useful. you can see that half of the fields are optional. However if I don't specify some of them the operation fails. Sometimes when I supply postal code as AP-1234 it fails, but when I supply just 1234 it passes. Each time I have to guess and try.

To be more specific. In the example I shared in the bug report the root cause was because of an ampty province code that is marked as optional

emakunin commented 2 months ago

I believe you should provide a schema for all fields or (actually "and") provide proper error message

mafge commented 2 months ago

@emakunin I see. Can you provide sample addresses which do not work for you so that I can work with the backend team to improve the error messages and the documentation?

emakunin commented 2 months ago

Sure,

I cannot provide exact addresses as it's customer's data. So you can assume that "X" chars are valid characters

Example 1

Input:

"sourceAddress": {
    "addressLine1": "XXXX XXXXX ",
    "addressLine2": null,
    "city": "Ghaziabad",
    "companyName": "XXXX XXXXX",
    "countryCode": "IN",
    "email": "XXXXXX@XXXXXX.in",
    "name": "XXXXXX XXXXXX",
    "phoneNumber": "+91773XXXXXXX",
    "postalCode": "201007",
    "stateOrProvinceCode": null
  }

Example 2

Sync response error:

{
  "errors": [
    {
      "code": "BadRequest",
      "message": "ERROR: Provided address is invalid. Please correct the address and try again.",
      "details": ""
    }
  ]
}

Input:

"sourceAddress": {
    "addressLine1": "XX/X-XX, BASEMENT & XND FLOOR, XXXXXXXX ROAD",
    "addressLine2": null,
    "city": "NEW DELHI",
    "companyName": "XXXXXX XXXXX",
    "countryCode": "IN",
    "email": "XXXXXX@XXXXXX.in",
    "name": "XXXXXX XXXXXX",
    "phoneNumber": "+91773XXXXXXX",
    "postalCode": "110015",
    "stateOrProvinceCode": "DELHI"
  }

Async operation error:

Operation problems: Problem: WARNING: Address was unable to be verified. Please ensure that this is the address you wish to use before proceeding. Severity: WARNING Details: null Problem code: BadRequest Problem: ERROR: Something went wrong. Please try again later. Severity: ERROR Details: null Problem code: InternalServerError

There's no way to understand what's going wrong. The legth of the lines are compatible with the document.

Note that if I set UP as province cod for the first example it works. For the second one I'm still trying to find an input that will please the API validation =\

mafge commented 2 months ago

@emakunin Thanks for providing the sample addresses! I was able to reproduce your issues on my side. I will follow up with the responsible backend team to improve documentation/error messages.

github-actions[bot] commented 1 month ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.

github-actions[bot] commented 1 month ago

closed for inactivity

emakunin commented 1 month ago

Hi @mafge,

Any updates? I like the Amazon's resolving approach. Just wait and If no enough complaints from the customers -> close... Is it a new amazon "earn trust" and "customer obsession" ?

mafge commented 1 month ago

Hi @emakunin, thanks for reminding me! The corresponding backend team deployed a fix to show more specific error messages when trying to create an inbound plan with invalid addresses.

emakunin commented 1 month ago

Cool thanks a lot for the update.