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

Orders GetServiceStatus #100

Open
Desmodue opened this issue Nov 20, 2017 · 1 comment
Open

Orders GetServiceStatus #100

Desmodue opened this issue Nov 20, 2017 · 1 comment

Comments

@Desmodue
Copy link

Desmodue commented Nov 20, 2017

When calling GetServiceStatus for the Orders API I get "Cannot read property 'list' of undefined" errors.
Looking through the code it would appear that /lib/request.js is checking for param.list when there isn't a param object.

I implemented a quick fix to check if param exists before trying to check if it has properties and executing this block of code. "if (param){" . This fixes the immediate error but I haven't had time to check if this is quite the right place to do this. Maybe the /lib/sections should define an empty params on GetServiceStatus ?

Here is the complete change, line 152 in /lib/request.js

            // Lists need to be sequentially numbered and we take care of that here
            if (param) {
                if (param.list) {
                    const values = _.map(toCollection(value), getValue);

                    _.forEach(values, (value, i) => {
                        this.values[`${param.name}.${i + 1}`] = value;
                    });
                } else {
                    this.values[param.name] = getValue(value);
                }
            }

Quite happy to do a pull request if this is ok

@sjuxax
Copy link

sjuxax commented Nov 24, 2017

I've encountered this when needlessly specifying the MarketplaceId; that is, when I send in a parameter that is not actually specced out by MWS. I added a similar hack to bypass this error, while also adding this to the log:

if (param === undefined) {
    console.log(`Couldn't find ${paramName} in request spec. Maybe you don't need it?`)
}

MWS seems to do fine with the extraneous variable so we don't stop the request, but just notify the user they may not need to send it in.

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

No branches or pull requests

2 participants