Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomError: Invalid 'sku' provided ? #126

Closed
gopkg-dev opened this issue Apr 11, 2022 · 6 comments
Closed

CustomError: Invalid 'sku' provided ? #126

gopkg-dev opened this issue Apr 11, 2022 · 6 comments
Labels
fix by amazon needed Bugs that need to be fixed by Amazon

Comments

@gopkg-dev
Copy link

let res = await sellingPartner.callAPI({
    operation: 'getListingsItem',
    endpoint: 'listingsItems',
    path: {
        sellerId: "xxxxxxxx",
        sku: "iPhone 11 Pro Max/XS Max-2Pack0526"
    },
    query: {
        marketplaceIds: ['A1C3SOZRARQ6R3'],
        includedData: ['summaries', 'attributes', 'procurement', 'fulfillmentAvailability', 'issues']
    },
});
console.log(res);
CustomError: Invalid 'sku' provided. SKU: iPhone%2011%20Pro%20Max%2FXS%20Max-2Pack0526
    at SellingPartner.callAPI (/Users/user01/Desktop/amazon-sp-api-test/node_modules/amazon-sp-api/lib/SellingPartner.js:597:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /Users/user01/Desktop/amazon-sp-api-test/main.js:16:19 {
  code: 'InvalidInput',
  details: '',
  type: 'error'
}
@amz-tools
Copy link
Owner

amz-tools commented Apr 11, 2022

Hi @gopkg-dev,

just spent some time investigating and found out that its quite an interesting bug. The encoding of the whitespace and the / is definitely correct as we can see in the error message you posted (we fixed these issues in version 0.7.0 of the client).

But what we noticed is that the error message we receive is different when we cut off the 0526 in the end:
CustomError: SKU 'iPhone%2011%20Pro%20Max%2FXS%20Max-2Pack' not found in marketplace

Thats actually the expected and correct result (since we don't have an SKU by that name). However, once we add any more characters to the SKU (it doesn't matter if its 0526 or anything else) we also start receiving the Invalid 'sku' provided error.

The issue here seems to be that Amazon allows SKUs to be only 40 characters long. The original SKU iPhone 11 Pro Max/XS Max-2Pack0526 is 34 characters long, but the encoded SKU iPhone%2011%20Pro%20Max%2FXS%20Max-2Pack0526 is 44 characters long. Thats obviously 4 characters above the limit and explains why it fails once we add any character after iPhone%2011%20Pro%20Max%2FXS%20Max-2Pack.

So it seems as if Amazon counts the characters before decoding the SKU and as such returns an error of an invalid (too long) SKU although thats actually not the case.

@gopkg-dev, could you open an issue with Amazon? I think we should let them know, I wouldn't think this is intentional behaviour.

@amz-tools amz-tools added the fix by amazon needed Bugs that need to be fixed by Amazon label Apr 11, 2022
@vhle-ms
Copy link
Contributor

vhle-ms commented Apr 21, 2022

FYI - I've raised a ticket a couple of days ago with Amazon. They've responded with the following:

"This is a known issue with our Technical teams, and I've added the examples you've provided to our existing contact with them regarding the issue. I''ll monitor this and let you know when we have more information to share."

@vhle-ms
Copy link
Contributor

vhle-ms commented Apr 25, 2022

Update from Amazon support:

"Our technical team has completed their review of how the SKUs were being handled through the API, and hope to push updates later in the week that will address the SKU not founds errors. I'll continue monitoring this issue and update you when the it has been completed."

@vhle-ms
Copy link
Contributor

vhle-ms commented Apr 30, 2022

Update from Amazon support:

"Our Technical team completed their updates to correctly handle the SKU encoding, and issue should now be resolved."

@amz-tools
Copy link
Owner

Can confirm the issue has been resolved, closing the ticket.

@sw-engineer-a
Copy link

Hey,
Issue still happened now.
Error: Invalid 'sku' provided. SKU: BOWNET-AD-SKU-BN-COMMANDER%20BAG%20ORANGE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix by amazon needed Bugs that need to be fixed by Amazon
Projects
None yet
Development

No branches or pull requests

4 participants