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

Unhandled 'ice' weather makes weather models throw #16

Closed
SenorKarlos opened this issue Dec 4, 2020 · 16 comments
Closed

Unhandled 'ice' weather makes weather models throw #16

SenorKarlos opened this issue Dec 4, 2020 · 16 comments

Comments

@SenorKarlos
Copy link

3|Castform | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
3|Castform | TypeError: Cannot read property 'windyable' of undefined
3|Castform |     at aw2pogo (/home/senorkarlos/Castform/model-th0rnleaf.js:57:28)
3|Castform |     at /home/senorkarlos/Castform/index.js:85:22
3|Castform |     at Array.map (<anonymous>)
3|Castform |     at /home/senorkarlos/Castform/index.js:80:64
3|Castform |     at /home/senorkarlos/Castform/node_modules/callbag-tap/index.cjs.js:6:42
3|Castform |     at /home/senorkarlos/Castform/node_modules/callbag-map/readme.js:27:5
3|Castform |     at /home/senorkarlos/Castform/node_modules/callbag-filter/readme.js:31:25
3|Castform |     at /home/senorkarlos/Castform/node_modules/callbag-flatten/index.cjs.js:26:29
3|Castform |     at onfulfilled (/home/senorkarlos/Castform/node_modules/callbag-from-promise/index.cjs.js:8:5)
3|Castform |     at processTicksAndRejections (internal/process/task_queues.js:97:5)

Let me know what i can research for you to try and help resolve it. I just pulled up to latest on v2-webhook but there were no changes to thornleaf nor do I have ratelimit concerns. Thanks :)

@5310
Copy link
Owner

5310 commented Dec 5, 2020

A lot of confusing things here. To start with, the th0rnleaf model hasn't been used in over a year, why do you have it enabled? (I should really get around to archiving them more visibly 🤔)

Secondly: so you updated from the pre-webhook branch to the webhooks right? Aside from these are the rest of your areas working?

@5310
Copy link
Owner

5310 commented Dec 5, 2020

So I can't recreate this at all.

Can you tell me what the weather data looks like just before it's processed by the model? It'll be the console.info output that should show up just before any exceptions inside the model that you posted.

The ones that look like this:

{
  key: 'hRLlgv9ifPGVBz32TT2vquY2QJtJUhDE',
  name: 'Howrah',
  id: '3318435',
  timezone: 'Asia/Kolkata',
  minute: 30,
  webhooks: [
    {
      id: '...',
      token: '...'
    }
  ]
}
{
  timestamp: '2020-12-05T10:37:58.254+05:30',
  info: 'predictions',
  location: 'howrah',
  payload: {
    '2020-12-05T11': 'hazysunshine',
    '2020-12-05T12': 'hazysunshine',
    '2020-12-05T13': 'hazysunshine',
    '2020-12-05T14': 'hazysunshine',
    '2020-12-05T15': 'hazysunshine',
    '2020-12-05T16': 'hazysunshine',
    '2020-12-05T17': 'hazymoonlight',
    '2020-12-05T18': 'hazymoonlight',
    '2020-12-05T19': 'clear',
    '2020-12-05T20': 'clear',
    '2020-12-05T21': 'clear',
    '2020-12-05T22': 'clear'
  }
}

@SenorKarlos
Copy link
Author

SenorKarlos commented Dec 5, 2020

th0rnleaf is literally in config example 1, and something called 'old' in 2 LOL - so which would you choose :D Direction on what to use probably step one LOL

I mentioned that I pulled to latest v2-webhook, and this was the default branch when I cloned it :D

If you want me to dig up logs on something 'obsolete' I will, but if I just need a new model (and your examples/libs cleaned up) we can start there lol

@5310
Copy link
Owner

5310 commented Dec 5, 2020

I wish there was a way to put comments in JSON. Without an explanation that it's optional it does get confusing. You should remove it from your configs as well, the default model is ajstewart and it'll be used automatically.

But the bug you faced has nothing to do with the model. The model function was being fed empty data and that would happen on any of them.

@SenorKarlos
Copy link
Author

ok I'll get you some logs from the affected areas :) just making sure, I have a TON of cells monitored on a commercial key so if it was pointless, not something i wanna shovel through :D

@SenorKarlos
Copy link
Author

SenorKarlos commented Dec 5, 2020

as for the commented JSON, most of the pogo app devs I work with will break the json out with comments in the README.MD & if it's optional, the value in example should be removed or matching default :)

@5310
Copy link
Owner

5310 commented Dec 5, 2020

Good thing you can just search through the logs for the exception and no shoveling is involved 😺

@SenorKarlos
Copy link
Author

this is one of the non-posters at the time of report. And yes, I have to dig, cuz despite setting 'combine_logs' in my pm2 environment, I still get an out and error log separate 😒 one of them things I've been meaning to look at fixing 😄

I've updated my config to use ajstweart now as well (ik default, but I like to keep values in use in view LOL)

{
  key: 'redacted',
  name: 'Carp',
  id: '55121',
  timezone: 'America/Toronto',
  minute: 5,
  model: 'th0rnleaf',
  webhooks: [
    {
      id: 'redacted',
      token: 'redacted'
    }
  ]
}
{
  timestamp: '2020-12-04T14:05:01.118-05:00',
  info: 'predictions',
  location: 'ott c6',
  payload: {
    '2020-12-04T15': 'showers',
    '2020-12-04T16': 'cloudy',
    '2020-12-04T17': 'cloudy',
    '2020-12-04T18': 'cloudy',
    '2020-12-04T19': 'flurries',
    '2020-12-04T20': 'flurries',
    '2020-12-04T21': 'mostlycloudy',
    '2020-12-04T22': 'intermittentclouds',
    '2020-12-04T23': 'mostlycloudy',
    '2020-12-05T00': 'mostlycloudy',
    '2020-12-05T01': 'cloudy',
    '2020-12-05T02': 'cloudy'
  }
}

@5310
Copy link
Owner

5310 commented Dec 5, 2020

None of those labels are amiss 🤔

Any chance you can shovel up the saved data for that hour; from data/aw/ott c6/2020-12-04.json?

@SenorKarlos
Copy link
Author

2020-12-04.zip
it wouldn't let me upload a json so i zipped it LOL

@5310
Copy link
Owner

5310 commented Dec 5, 2020

Well, found the culprit. It's a 'never-before-seen' weather label of "ice". Do you get this often?

It wasn't on the hour 14 though, but queryhours 4–10 have some ice forecasts for 4pm and 6pm.

Can you keep an eye out whether you get any snow in-game for those hours and then let me know?

Turns out it's a rare (could be chiefly Torontonian) condition that AW reports, and the sole TSR thread I could find doesn't tell me anything conclusive about what in-game weather it usually maps to, so you'll have to do some observations for us :]

I am updating all three models with a tentative case for 'ice' forecasts for now defaulting to clear, because I have a feeling people would've reported it more as positive had they noticed it as snow in-game.

@5310 5310 changed the title Several areas not posting, this error repeats in logs Unhandled 'ice' weather makes weather models throw Dec 5, 2020
@SenorKarlos
Copy link
Author

LOL this is Northern Ontario, Canada. Ice is a way of life 😂

I'll gladly make some observations, likely more thru the month as winter picks up. I started running this when i posted that windy icon issue, so first time encountering it in your app 😄 Gonna pull the updates and will report with more ASAP

I'll also get my users on the case, so I have more eyes and local verification.

@5310
Copy link
Owner

5310 commented Dec 5, 2020

You can pull v2-webhook now, it has the new condition for all three models (after two embarassing force pushes that we shall not talk about.)

I wish we had snow in-game over here...or windy, or even foggy since that one time half the country got stuck with mid-day fog due to anomalous real-life conditions, or players who actually bother reporting discrepencies with the forecasts in my community :pepehands:...

@SenorKarlos
Copy link
Author

so.... LOL - after attempting to pull, fighting with git, backing up my config/data, nuking it, recloning it and starting up, I get this spamming the error log. It's not even time for it to run yet

4|Castform  | /home/senorkarlos/Castform/model-ajstewart.js:172
4|Castform  |   const weather = weatherMap[label] ?? { dominant: 'unknown', superficial: {}, windyable: false }
4|Castform  |                                      ^
4|Castform  | SyntaxError: Unexpected token '?'
4|Castform  |     at wrapSafe (internal/modules/cjs/loader.js:931:16)
4|Castform  |     at Module._compile (internal/modules/cjs/loader.js:979:27)
4|Castform  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
4|Castform  |     at Module.load (internal/modules/cjs/loader.js:879:32)
4|Castform  |     at Function.Module._load (internal/modules/cjs/loader.js:724:14)
4|Castform  |     at Module.require (internal/modules/cjs/loader.js:903:19)
4|Castform  |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
4|Castform  |     at require (internal/modules/cjs/helpers.js:74:18)
4|Castform  |     at Object.<anonymous> (/home/senorkarlos/Castform/index.js:35:22)
4|Castform  |     at Module._compile (internal/modules/cjs/loader.js:1015:30)
4|Castform  | /home/senorkarlos/Castform/model-ajstewart.js:172
4|Castform  |   const weather = weatherMap[label] ?? { dominant: 'unknown', superficial: {}, windyable: false }
4|Castform  |                                      ^

😂 no more force commits lolol

@5310
Copy link
Owner

5310 commented Dec 5, 2020

You got merge conflicts? Must've pulled between my forced ones I guess. Nothing about the config or data changed either, you could've just force pulled as well...

Either way, that error is because your Node version doesn't support the nullish coalescing operator. You would have to update to Node 14+

(I will update the package's required Node version and other metadata after this week's changes settle.)

@SenorKarlos
Copy link
Author

LOL I think everything I run supports 14 but I have 12, wasn't an issue before. I'll check my stuff and update

@5310 5310 closed this as completed Feb 9, 2021
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