Closed jircdev closed 1 year ago
Hey,
The error comes from the AWS sdk.
You need to specify an AWS region to the SellingPartnerApiAuth
for the STS calls:
const auth = new SellingPartnerApiAuth({
clientId: CLIENT_ID,
clientSecret: ACCESS_SECRET_KEY,
refreshToken: REFRESH_TOKEN,
accessKeyId: ACCESS_KEY_ID,
secretAccessKey: ACCESS_SECRET_KEY,
+ region: 'us‑west‑1', // Or your preferred AWS region
role: {
arn: ARN,
},
});
This can also be done using the AWS_DEFAULT_REGION
environment variable.
I’ve updated to clients’ READMEs to include samples for this.
Thank you. I followed the example in the docs and thought everything was okay since I saw it in the FbaInventoryApiClient.
I have another doubt, and I'm not sure if you can answer it in this thread. I will ask, and please let me know if I need to close the ticket. Thank you for your patience.
I am receiving a 401 error with the message "SellingPartnerApiAuthError: access-token error: Response code 401."
I'm not sure what the correct way to proceed is. I understood that I need to set the "accessToken". While checking out the parameters of SellingPartnerAuth, I saw the "sessionToken." Is it the same? If not, what is the correct way to generate the access token using the package? Can I get the access token using some method?
I have the next code now:
In the console of "auth.accessToken", the scopes, value and expiration dates are ":undefined" as I show:
In the role: arn value of the instance I am setting the SellingPartner role arn. Is it Correct? Thank you very much for your help.
@jircdev something must be wrong with your configuration values. I’m thinking maybe ACCESS_SECRET_KEY
that is both used for clientSecret
and secretAccessKey
.
clientId
and clientSecret
are LWA credentials.
accessKeyId
and secretAccessKey
are AWS credentials.
https://github.com/bizon/selling-partner-api-sdk/tree/master/packages/auth should have all the info you need.
Thank you for your response. I appreciate your feedback. Another developer has informed me that it may not be possible to directly access inventory data and that working with reports may be necessary. I had attempted to use the Amazon inventory API to retrieve the available quantity of specific SKUs. However, if it is indeed not possible to access the data directly, I will need to implement a cron job instead of using this package. Could you please confirm if this is the correct approach? Thank you once again for your help.
Hi, first of all, I'd like to thank you for your help.
I'm attempting to configure the selling-partner-api-sdk to retrieve the inventory information from my Amazon seller partner account, but I am encountering an error "region is missing" from the "@aws-sdk" package. I have already defined the region in the instance of "FbaInventoryApiClient." I'm not sure if this is an error or just a bad implementation,
This is my code (All values in upper are constants):
I got the next error:
Trying to debug, I found that the "sts property of the SellingPartnerApiAuth has an undefined value in region property as you can see in the following image:
Thanks for your answer