Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:authorize_with: :error is not available with Ash.get/3 #1592

Open
binarypaladin opened this issue Nov 8, 2024 · 2 comments
Open

:authorize_with: :error is not available with Ash.get/3 #1592

binarypaladin opened this issue Nov 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@binarypaladin
Copy link
Contributor

Describe the bug
The :authorize_with: :error option is not available with Ash.get/3 but works as expected with Ash.read/2 and Ash.read_one/2.

To Reproduce
Pass :authorize_with to Ash.get/3.

Expected behavior
I should get back {:error, %Ash.Error.Forbidden{} and instead an exception is raised:

{:error,
 %Ash.Error.Unknown{
   errors: [
     %Ash.Error.Unknown.UnknownError{
       error: "** (Spark.Options.ValidationError) unknown options [:authorize_with], valid options are: [:error?, :load, :lock, :tenant, :action, :context, :reuse_values?, :domain, :timeout, :tracer, :action, :authorize?, :context, :tenant, :actor]",
       field: nil,
       value: nil,
       splode: Ash.Error,
       bread_crumbs: [],
       vars: [],
       path: [],
       stacktrace: #Splode.Stacktrace<>,
       class: :unknown
     }
   ]
 }}

Runtime

  • Elixir version 1.17.2
  • Erlang version 27.0.1
  • OS macOS 15.0.1
  • Ash version 3.4.41

Additional context
Discussed in Discord already and was told to make an issue.

@binarypaladin binarypaladin added bug Something isn't working needs review labels Nov 8, 2024
@binarypaladin
Copy link
Contributor Author

I'd like to add that, similarly, this happens with Ash.Changeset.manage_relationship/4.

@ken-kost
Copy link
Contributor

I'd like to add that, similarly, this happens with Ash.Changeset.manage_relationship/4.

I made a PR for the Ash.get! fix but not sure what you mean for manage_relationship. Could you expand on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants