Closed fny closed 3 years ago
Can you please confirm which version of the package you are using?
Most likely need to add an entry here:
Please add a test case with some data.
Perhaps by editing one of the existing files for tests, and add a number-lile value:
And then re-run the tests with -u
to update the snapshots.
It's the latest version 1.9.56
There was some attempt to fix this within ensureString, but it didn't behave the way I thought it would. I'll try to get this fixed tonight. Thanks for being so responsive!
Quick q: do you know how to pin a module to a local version? I've tried the line below, and node keeps complaining it can't resolve @scaleleap/amazon-mws-api-sdk
.
"@scaleleap/amazon-mws-api-sdk": "file:../amazon-mws-api-sdk",
Quick q: do you know how to pin a module to a local version? I've tried the line below, and node keeps complaining it can't resolve
@scaleleap/amazon-mws-api-sdk
."@scaleleap/amazon-mws-api-sdk": "file:../amazon-mws-api-sdk",
Maybe it's because the original is in TS and node cannot find the built files.
Have you tried running npm run build
in the mws package repo first? This should put the built files into lib/
.
But you'll need to re-run it every time you make a change.
Also, I found this useful before: https://github.com/wclr/yalc
I've solved it. The trick is to use the ensureString
codec rather than the string
codec wherever SellerFulfillmentOrderId
is defined. I don't think this is a good long term solution however.
The core issue is that XML can't discriminate between a number or a string, so if anything looks remotely like a number, it will be parsed as such. You guys already picked up on this issue with things like postal code which likely broke for leading zeros:
<PostalCode>02770</PostalCode>
Given the current codecs, this bug will keep popping up. Imagine a phone number provided without dashes or an apartment number. There's no reliable way to guarantee any string field might not look like a number.
I think a better solution would be to have the XML parser return strings by default (parseNodeValue: false
) and then use a special codec to transform the values you know should be numbers to numbers (i.e. Qty
) since theres an absolute guarantee Amazon isn't going to return something else.
Let me know what you think!
I think you are totally right. But this is probably a massive change though. However, if you feel like doing this, I will certainly accept and merge the PR.
I have just done a lot of clean-up on the CI and test infra. It should be easier to submit PRs as tests will run properly without failure.
A way to get to quick failure and iteration is probably flip the parseNodeValue
flag and then see what fails during snapshot tests. Then go and fix that codec.
Fixed in #422
I have some order ids that are numbers (e.g. "23914352147") which fail when calling getFulfillmentOrder.
I think Amazon is responding with a number rather than a string which is causing the codec to choke. Still trying to figure out a patch, guidance is appreciated.