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

Error: Cannot read property 'split' of undefined #1

Open
henrinormak opened this issue Mar 24, 2016 · 0 comments
Open

Error: Cannot read property 'split' of undefined #1

henrinormak opened this issue Mar 24, 2016 · 0 comments

Comments

@henrinormak
Copy link

With nested functions/definitions, an error occurs when the inner value is not defined on the parameters/payload.

Minimal example that causes this problem:

var mappingTemplate = require('api-gateway-mapping-template');

var template = '$util.escapeJavaScript($input.params(\'test\'))';

var params = {
    header: {},
    querystring: {},
    path: {}
};
var payload = '';

var result = mappingTemplate({
    template: template,
    params: params
    payload: payload
});

// Results in error similar to
// Error: Cannot read property 'split' of undefined on $util.escapeJavaScript($input.params('test')) at L/N 1:0

Expected behavior (and as far as I understand, what API Gateway would actually do) is to resolve this to be completely undefined, meaning calls to util functions with an undefined parameter results in an undefined value.

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

1 participant