Skip to content

Issue syncing to GitHub is trying to change relationship of github_pull_request #1253

Closed
@joshsmith

Description

@joshsmith

https://sentry.io/code-corps/code-corps-api/issues/409216164/

Elixir.RuntimeError: you are attempting to change relation :github_pull_request of
CodeCorps.GithubIssue but the `:on_replace` option of
this relation is set to `:raise`.

By default it is not possible to replace or delete embeds and
associations during `cast`. Therefore Ecto requires all existing
data to be given on update. Failing to do so results in this
error message.

If you want to replace data or automatically delete any data
not sent to `cast`, please set the appropriate `:on_replace`
option when defining the relation. The docs for `Ecto.Changeset`
covers the supported options in the "Related data" section.

However, if you don't want to allow data to be replaced or
deleted, only updated, make sure that:

  * If you are attempting to update an existing entry, you
    are including the entry primary key (ID) in the data.

  * If you have a relationship with many children, at least
    the same N children must be given on update.


  File "lib/ecto/changeset/relation.ex", line 201, in Ecto.Changeset.Relation.on_replace/2
  File "lib/ecto/changeset/relation.ex", line 131, in Ecto.Changeset.Relation.change/3
  File "lib/ecto/changeset.ex", line 1049, in Ecto.Changeset.put_change/7
  File "lib/ecto/changeset.ex", line 1136, in Ecto.Changeset.put_relation/5
  File "lib/code_corps/github/sync/issue/github_issue/github_issue.ex", line 40, in CodeCorps.GitHub.Sync.Issue.GithubIssue.create_or_update_issue/3
...
(3 additional frame(s) were not displayed)

(RuntimeError) you are attempting to change relation :github_pull_request of
CodeCorps.GithubIssue but the `:on_replace` option of
this relation is set to `:raise`.

By default it is not possible to replace or delete embeds and
associations during `cast`. Therefore Ecto requires all existing
data to be given on update. Failing to do so results in this
error message.

If you want to replace data or automatically delete any data
not sent to `cast`, please set the appropriate `:on_replace`
option when defining the relation. The docs for `Ecto.Changeset`
covers the supported options in the "Related data" section.

However, if you don't want to allow data to be replaced or
deleted, only updated, make sure that:

  * If you are attempting to update an existing entry, you
    are including the entry primary key (ID) in the data.

  * If you have a relationship with many children, at least
    the same N children must be given on update.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions