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

query params bugfix #138

Closed
wants to merge 1 commit into from
Closed

query params bugfix #138

wants to merge 1 commit into from

Conversation

baran-ozer
Copy link

Hello fellas, we are using this useful package but we've noticed when we pass query params as

query: {
        MarketplaceIds: ["ATVPDKIKX0DER"],
        CreatedAfter: "2022-06-14T15:00:00-07:00",
},

created request generated as "https://sellingpartnerapi-na.amazon.com/orders/v0/orders?CreatedAfter=2022-06-01T00%3A00%3A00-07%3A00&MarketplaceIds%5B%5D=ATVPDKIKX0DER" so amazon api raises error missing MarketplaceIds. I know this is not a reliable solution but it will hold until the next update.

@amz-tools
Copy link
Owner

Hi @baran-ozer,

we can't recreate the bug, when we try the request you posted it works as expected. What's the error message you receive? Also, are you using the latest version of the client?

@baran-ozer
Copy link
Author

baran-ozer commented Jun 20, 2022

Hi,
CustomError: Missing or invalid request parameters: [MarketplaceIds] at SellingPartner.callAPI (/Users/baran/Orion Projects/Amazon Sp Api JS/node_modules/amazon-sp-api/lib/SellingPartner.js:597:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async main (/Users/baran/Orion Projects/Amazon Sp Api JS/index.js:12:15) { code: 'InvalidInput', type: 'error' }

driver creates a request URL but adds "MarketplaceIds%5B%5D" instead of "MarketplaceIds" to query string when you give an array with only 1 element. When you give two or more values in the array there is no problem. I am using version 0.7.7.

@jiangdi0924
Copy link

jiangdi0924 commented Jun 21, 2022

in our server environment( ubuntu OS ) find same issue, but in macOS is ok;
CustomError: Missing or invalid request parameters: [MarketplaceIds] at SellingPartner.callAPI (/XXXXXX/node_modules/amazon-sp-api/lib/SellingPartner.js:597:13) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async getLastHourModifyOrders (/home/XXXXX/test_order.js:44:30) at async /home/apps/explode/backend/XXXXX/test_order.js:64:7 { code: 'InvalidInput', type: 'error' }

@jiangdi0924
Copy link

use MarketplaceIds:'A1VC38T7YXB528', replace MarketplaceIds:['A1VC38T7YXB528'] can work,but no a good way...

@baran-ozer
Copy link
Author

Hi @amz-tools , @jiangdi0924 also saw the problem. Thanks @jiangdi0924.

amz-tools added a commit that referenced this pull request Jun 28, 2022
…ssues with incorrect formatting arrays of length 1 (#138)
@amz-tools
Copy link
Owner

Hi @baran-ozer, @jiangdi0924,

sorry for the late reply, we now have had the time to take a closer look. The issue seems to have the origin with qs npm module, see this issue.

This somehow breaking change has been seen quite critical and as a result, the maintainers of qs module introduced a new option now that should resolve the issue you experience.

Could you check out the branch array_format_comma_fix and give me feedback if the issue is resolved inside that branch? If so we can include the fix and publish a new version.

@baran-ozer
Copy link
Author

Hi @amz-tools, I checked branch array_format_comma_fix and this branch solves the problem, thanks.

@amz-tools
Copy link
Owner

@baran-ozer Thanks for confirming, we just released v0.7.8 containing the fix.

@amz-tools amz-tools closed this Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants