Shields: Packagist internal error: Can't generate a version color for undefined

Created on 13 Jul 2019  路  10Comments  路  Source: badges/shields

https://sentry.io/organizations/shields/issues/1109294293/?referrer=github_plugin

Error: Error: Can't generate a version color for undefined
  File "/home/m/shields/core/server/log.js", line 40, in Function.error
    Raven.captureException(msg, sendErr => {
  File "/home/m/shields/core/base-service/base.js", line 298, in PackagistVersion._handleError
    log.error(error)
  File "/home/m/shields/core/base-service/base.js", line 386, in Function.invoke
    serviceData = serviceInstance._handleError(serviceError)
...
(1 additional frame(s) were not displayed)

Error: Error: Can't generate a version color for undefined
bug sentry service-badge

Most helpful comment

I'm not sure the schema forbids an empty versions object.

We may still end up with an empty versions list even though the Joi schema forbids it. Indeed, there is a filter in the PackagistVersion implementation:
versions.filter(version => !/^dev-/.test(version))

The filter is probably still relevant, it was introduced many years ago following this discussion. If my understanding is correct, they aren't actually released versions, they just correspond to branches on a repository, hence the "dev" prefix.

I think a potential fix here is to check if any versions are left in the list before rendering the badge, and if not display something along the lines of no released version found to the user instead.

I'll submit a PR for this. Given that we don't have much information on what caused the root problem, there's no guarantee it will fix all the errors, however it still seems like a sensible check to do anyway.

All 10 comments

This is generating an "internal error" badge. The stack trace is obscure and I'm not sure exactly why that is. On Sentry, the additional stack frame looks like this:

Screen Shot 2019-07-14 at 5 10 46 PM

There's also this error:

Screen Shot 2019-07-14 at 5 10 50 PM

As of now, this has occurred 844 times in the last two days.

This is probably the same error as #3684.

Possible root cause (https://github.com/badges/shields/issues/3684#issuecomment-510320138)

One possible bug from reading the code: what happens if you call latest([])? I'm not sure the schema forbids an empty versions object.

I'm not sure the schema forbids an empty versions object.

We may still end up with an empty versions list even though the Joi schema forbids it. Indeed, there is a filter in the PackagistVersion implementation:
versions.filter(version => !/^dev-/.test(version))

The filter is probably still relevant, it was introduced many years ago following this discussion. If my understanding is correct, they aren't actually released versions, they just correspond to branches on a repository, hence the "dev" prefix.

I think a potential fix here is to check if any versions are left in the list before rendering the badge, and if not display something along the lines of no released version found to the user instead.

I'll submit a PR for this. Given that we don't have much information on what caused the root problem, there's no guarantee it will fix all the errors, however it still seems like a sensible check to do anyway.

@paulmelnikow are there still any errors reported on Sentry about this?

I can't tell. Something really strange is going on with Sentry.

When I click on that error, I'm seeing the same stack trace (unsurprising) but a totally different message, "Error: Token pool is exhausted."

It seems like Sentry has started mixing all our errors together.

Some ideas on fixes:

  • Migrating to the newer Sentry SDK (#3708)
  • Dropping use of domain
  • Upgrading to Node 12

@paulmelnikow that's annoying. I've started by reviewing the linked PR. 馃槈

I guess this is only affecting the Shields internal errors that bubble through our own error handling. These are the ones we started monitoring just recently, in #3706.

3762 didn't seem to have an effect on this issue, however I did figure out how to see individual events (i.e. a single time the error happened). Here I can see the message that corresponds to each, though still not the full stack trace.

So, I can confirm this particular Packagist error is gone, though I'm getting a new one.

Okay, feel free to open another issue when you've got more info about this other error!

Thought I had, but I guess I didn't click the button! #3767

Was this page helpful?
0 / 5 - 0 ratings

Related issues

irgolic picture irgolic  路  3Comments

salaros picture salaros  路  3Comments

kirankotari picture kirankotari  路  3Comments

AlexWayfer picture AlexWayfer  路  3Comments

najeeb-ur-rehman picture najeeb-ur-rehman  路  3Comments