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

Cannot read property 'toISOString' of undefined #12

Closed
martinstoyanov opened this issue Jul 29, 2020 · 4 comments
Closed

Cannot read property 'toISOString' of undefined #12

martinstoyanov opened this issue Jul 29, 2020 · 4 comments
Labels

Comments

@martinstoyanov
Copy link

martinstoyanov commented Jul 29, 2020

This issue arises sometimes, not every time but once it is there it keeps on happening.

Query: npm run start -- stock --country us S19282863

Output:

(node:17224) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toISOString' of undefined
    at /Users/martinstoyanov/Downloads/ikea/node_modules/ikea-availability-checker/source/lib/reporter/stock-table.js:57:32
    at Array.map (<anonymous>)
    at Object.createReport (/Users/martinstoyanov/Downloads/ikea/node_modules/ikea-availability-checker/source/lib/reporter/stock-table.js:56:8)
    at /Users/martinstoyanov/Downloads/ikea/node_modules/ikea-availability-checker/source/cli-stock.js:114:45
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'm on the latest version. Thanks!

@eslendil
Copy link

how do you run this ?

@Ephigenia
Copy link
Owner

I‘ll check this later. Probably an empty or invalid response. Needs debugging in the response handling.

@Ephigenia
Copy link
Owner

Thanks for finding this.

Unfortunatly I’m not able to reproduce the issue by running the command this time:

npm run start -- stock --country us S19282863

However, I think that the issue might be caused by an response that contains unexpected data and/or nested objects which result to an availability which is undefined.

Can you please run the command again using the DEBUG environment variable to get some more debug information about the reply from the IOWS API:

DEBUG=* npm run start -- stock --country us S19282863

That information might help me to fix this issue.

@Ephigenia
Copy link
Owner

@martinstoyanov can you please confirm that the issue is still happening or not. I’ll like to close this issue in some time when the problem is not active at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants