Closed connorjacobsen closed 1 month ago
The decoder defaults to using the :safe
option for decoding. That means it won't create unknown atoms, among other safeguards. What's likely happening is the atom in your map doesn't currently exist in the runtime, perhaps because it ran on a separate node.
You can change the decoding behavior in your application using the format_recorded/2 callback in a custom resolver. Here's an example that omits the [:safe]
flag:
def format_recorded(recorded, _job) do
recorded
|> decode_recorded([])
|> inspect(pretty: true)
end
Check the resolver docs for more on usage and the other available callbacks.
Thank you! Sorry for not seeing that in the docs.
No problem at all! It's not especially obvious from the error message and you'd have no way to link that back to Web docs anyhow 🙂
Environment
2.18.3
1.4.13
2.10.5
PostgreSQL 16.3 (Debian 16.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
elixir --version
)1.17.2
27.0.1
Current Behavior
When using structured jobs, I am sometimes running into certain jobs that cause the Oban Web UI to throw Internal Server Errors when going to the job detail view. The return values of these jobs are all of the form
{:ok, map()}
(the data itself is justmap()
). Unfortunately I cannot post the raw objects for security reasons (but happy to include map shape and keys if helpful), but it's basically just a result JSON blob from an API call that I am storing. No functions or anything I would imagine to be sketchy or unsafe.Stacktrace:
If I go find the job in the
oban_jobs
DB table and grab thereturn
key from themeta
column and then run theOban.Web.Resolver.decode_recorded
function on the data, it returns an object just fine. Always possible it's running that function on some different piece of data, maybe? What's even weirder is sometimes it renders fine at first but then eventually stops - not sure if there's a pattern or what it is, though.This happens both for jobs in both the
completed
andretryable
state.Obviously, happy to provide more info if there's something you think would be helpful!
Expected Behavior
I expect the UI to render and show the job detail / result.