I'm developing a private application using the sp-api from Amazon.
And I want to create a Listing service to sell my used book so I'm using the Feeds API.
I always use the x-amz-token for the moment. I fetch it in my middleware and send in it to amazon in the request header and it always worked.
Even for createFeedDocument: without it, it doesn't work. With it everything is good.
But once i do the uploadFeed request i keep getting an error :
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>There were headers present in the request which were not signed</Message> <HeadersNotSigned>x-amz-access-token</HeadersNotSigned>
<RequestId></RequestId>
<HostId></HostId>
</Error>
And when I check on the documentation for uploadFeed or in the useCase for Feed (v2021) I dont find anything about it.
I watch this video from Amazon Seller University too and in the doc they talk about selfAuthorized in the developer panel. Is it what I need to do here ? Or do I need more something else to fix the error ?
OK so I found the answer,
My problem was: I didn't need AUTH for this request unlike the others.
Here is the code I used:
const headers = {
'Content-Type': 'text/xml; charset=UTF-8',
};
const feed = builderFeed();
const response = await axios.put(document.url, Buffer.from(feed), {
headers,
});
And with this it's working.