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

Exception while checking spot/termination_time #6

Open
wbecker opened this issue Jan 25, 2023 · 0 comments
Open

Exception while checking spot/termination_time #6

wbecker opened this issue Jan 25, 2023 · 0 comments

Comments

@wbecker
Copy link

wbecker commented Jan 25, 2023

I have found this error in my logs:

TypeError: Cannot read properties of undefined (reading 'statusCode')
at Request._callback (/usr/src/app/node_modules/ec2-spot-notification/lib/index.js:87:35)

This corresponds to this code:

 request.get("spot/termination-time", SpotNotification.requestOpts, function (error, response, body) {
                if (!error && response.statusCode === 200) {
                    // TODO: check value is date string or not
                    resolve(moment(body));
                }
                else if (response.statusCode === 404) {  // HERE
                    resolve(null);
                }
                else {
                    reject(error || response.statusCode);
                }
            });

The code should check for error before accessing response.statusCode

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