lightning
lightning copied to clipboard
Credential schema validator throwing 500 on /credentials list
USE THE 2018 BRANCH. The failing test has already been built.
- Click here: https://github.com/OpenFn/lightning/compare/2018?expand=1
My guess is that the customer here has a credential which, for one reason or another, no longer matches the schema required by that adaptor.
Right now, we should not be throwing a 500 on the credentials list view if one of the user's credentials doesn't match the JSON schema defined in the adaptor package.
Later, we need to handle:
- #1588
- associating credentials with previous versions of adaptor schemas?
CaseClauseError: no case clause matching: %ExJsonSchema.Validator.Error.Format{expected: "hostname"}
Sentry Issue: LIGHTNING-B0
CaseClauseError: no case clause matching: %ExJsonSchema.Validator.Error.Format{expected: "hostname"}
File "lib/lightning/credentials/schema.ex", line 98, in Lightning.Credentials.Schema.error_to_changeset/2
File "lib/enum.ex", line 2528, in Enum."-reduce/3-lists^foldl/2-0-"/3
File "lib/lightning_web/live/credential_live/json_schema_body_component.ex", line 16, in LightningWeb.CredentialLive.JsonSchemaBodyComponent."fieldset (overridable 1)"/1
File "lib/phoenix_live_view/tag_engine.ex", line 69, in Phoenix.LiveView.TagEngine.component/3
File "lib/lightning_web/live/credential_live/form_component.ex", line 552, in anonymous fn/2 in LightningWeb.CredentialLive.FormComponent."form_component (overridable 1)"/1
...
(1 additional frame(s) were not displayed)
(CaseClauseError no case clause matching: %ExJsonSchema.Validator.Error.Format{expected: "hostname"})
@elias-ba:
case error do
%{expected: "uri"} ->
Changeset.add_error(changeset, field, "expected to be a URI")
%{any_of: formats} ->
In schema.ex, we don't have a case for %..{expected: "hostname"}, so we could just add a match for that - or change the schema... I'm not sure what the hostname type is, like how do we validate that? Who added the hostname type? Should we care/validate that?
Closing as this hasn't appeared on Sentry in a long time