Skip to content

[Uptime] Fix es query function null reference errors - #61465

Merged
justinkambic merged 1 commit into
elastic:masterfrom
justinkambic:uptime_pings-null-reference
Mar 27, 2020
Merged

justinkambic merged 1 commit into
elastic:masterfrom
justinkambic:uptime_pings-null-reference

Conversation

@justinkambic

@justinkambic justinkambic commented Mar 26, 2020 •

Copy link
Copy Markdown
Contributor

Summary

This doesn't really happen in practice, but if the details page is loaded for a monitor that has no documents, we can encounter some null reference problems, which are logged in the Kibana log like so:

server    log   [10:14:45.632] [error][http] TypeError: Cannot read property 'by_id' of undefined
    at Object.getLatestMonitor (/Users/jk/git/justinkambic/kibana/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts:72:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)
server   error  [10:14:45.437]  Error: Internal Server Error
    at HapiResponseAdapter.toInternalError (/Users/jk/git/justinkambic/kibana/src/core/server/http/router/response_adapter.ts:56:19)
    at Router.handle (/Users/jk/git/justinkambic/kibana/src/core/server/http/router/router.ts:268:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)

This patch adds some optional chaining to prevent these reference problems from happening.

Even though this doesn't happen much today, it could happen in the future if these query functions are utilized elsewhere in the app in the future.

For maintainers

@justinkambic justinkambic added bug Fixes for quality problems that affect the customer experience release_note:fix v8.0.0 Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.7.0 v7.8.0 labels Mar 26, 2020
@justinkambic justinkambic self-assigned this Mar 26, 2020
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/uptime (Team:uptime)

@kibanamachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@justinkambic
justinkambic marked this pull request as ready for review March 26, 2020 16:48
@justinkambic

Copy link
Copy Markdown
Contributor Author

I didn't create an issue for this because the fix took less time than it would've taken to document it with an issue, but if needed I'll gladly create one.

@shahzad31 shahzad31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

@justinkambic
justinkambic merged commit 7224253 into elastic:master Mar 27, 2020
justinkambic added a commit to justinkambic/kibana that referenced this pull request Mar 27, 2020
justinkambic added a commit to justinkambic/kibana that referenced this pull request Mar 27, 2020
@justinkambic

Copy link
Copy Markdown
Contributor Author

@justinkambic
justinkambic deleted the uptime_pings-null-reference branch March 28, 2020 00:06
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience release_note:fix Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.7.0 v7.8.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants