Skip to content

Do not try to render cached data if none is there#623

Merged
vasconsaurus merged 1 commit into
mainfrom
bug/nomethoderror-process_and_return_json
Apr 23, 2026
Merged

Do not try to render cached data if none is there#623
vasconsaurus merged 1 commit into
mainfrom
bug/nomethoderror-process_and_return_json

Conversation

@vasconsaurus
Copy link
Copy Markdown
Contributor

@vasconsaurus vasconsaurus commented Apr 14, 2026

Description

Motivation

We keep getting a NoMethodError from render_as_json because
data was nil.

Since the Pender Audit had been pretty stable and under control, I took
some time to look into this. Fewer errors mean less work in the audit hour.

Sentry Issue: PENDER-1AG

Cause

When we got a timeout, and 'must_render' was set to false, we called render_as_json.
Because of the timeout, data was nil, which caused our NoMethodError.
It still "worked", meaning a media was created because this error was caught and dealt with eventually.

Fix

If we get a timeout we always must render so we can hardcode true.

How has this been tested?

I added a new test should not try to render cached data if none is there.
rails test test/controllers/medias_controller_test.rb:169

@vasconsaurus vasconsaurus changed the title Trying to deal with the NoMethodError we keep getting WIP: Trying to deal with the NoMethodError we keep getting Apr 14, 2026
When we get a timeout, and 'must_render' was set to false,
we called render_as_json, but data was nil. Which cause our
NoMethodError.

It still worked, because this error was caught and dealt
with eventually.

Still, if we get a timeout we always must render, so we can
hardcode true, and avoid the error we saw in Sentry.
@vasconsaurus vasconsaurus force-pushed the bug/nomethoderror-process_and_return_json branch from 26f4f63 to 9b191d8 Compare April 21, 2026 13:00
@vasconsaurus vasconsaurus changed the title WIP: Trying to deal with the NoMethodError we keep getting Deal with the NoMethodError we keep getting Apr 21, 2026
@vasconsaurus vasconsaurus changed the title Deal with the NoMethodError we keep getting Do not try to render cached data if none is there Apr 21, 2026
@vasconsaurus vasconsaurus marked this pull request as ready for review April 21, 2026 13:12
@vasconsaurus vasconsaurus requested a review from melsawy as a code owner April 21, 2026 13:12
@vasconsaurus vasconsaurus merged commit 0f28e1a into main Apr 23, 2026
5 checks passed
@vasconsaurus vasconsaurus deleted the bug/nomethoderror-process_and_return_json branch April 23, 2026 18:37
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

Successfully merging this pull request may close these issues.

2 participants