Skip to content

Commit

Permalink
Resolve adaptor before sending to worker
Browse files Browse the repository at this point in the history
Fixes #1369
  • Loading branch information
stuartc committed Nov 14, 2023
1 parent 8967e6a commit b0d91f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/lightning_web/channels/attempt_json.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
defmodule LightningWeb.AttemptJson do
@moduledoc false

alias Lightning.AdaptorRegistry
alias Lightning.Attempt
alias Lightning.Workflows.{Trigger, Edge, Job}
alias Lightning.Workflows.Edge
alias Lightning.Workflows.Job
alias Lightning.Workflows.Trigger

def render(%Attempt{} = attempt) do
%{
Expand All @@ -23,7 +28,7 @@ defmodule LightningWeb.AttemptJson do
def render(%Job{} = job) do
%{
"id" => job.id,
"adaptor" => job.adaptor,
"adaptor" => AdaptorRegistry.resolve_adaptor(job.adaptor),
"credential_id" => get_credential_id(job),
"body" => job.body,
"name" => job.name
Expand Down
2 changes: 1 addition & 1 deletion test/lightning_web/channels/attempt_channel_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ defmodule LightningWeb.AttemptChannelTest do
"name" => job.name,
"body" => job.body,
"credential_id" => credential.id,
"adaptor" => job.adaptor
"adaptor" => "@openfn/[email protected]"
}
]

Expand Down

0 comments on commit b0d91f0

Please sign in to comment.