moxley

moxley

After updating ash from version 2.17.11 to 2.17.12, 9 test failures showed up in my test suite. All the failures were on API tests that use ash_graphql. I’m on ash_graphql 0.25.13. All the failures are the same: the response contains the "message": "forbidden" error, the kind you get when the actor doesn’t have permission to access something. The logs did not contain any policy breakdown (it seems never to work during ash_graphql tests).

These are all the log entries that are logged for a failing test:

20:00:26.004 request_id=F8qg_y1LnSpDpzwAAA2B [info] POST /api/gql
20:00:26.029 request_id=F8qg_y1LnSpDpzwAAA2B [info] GF.Carts.PaymentMethodInput.create
20:00:26.029 request_id=F8qg_y1LnSpDpzwAAA2B [info] Sent 200 in 24ms

My config/test.exs contains this :ash, :policies entry:

config :ash, :policies,
  show_policy_breakdowns?: true,
  log_policy_breakdowns: :info,
  log_successful_policy_breakdowns: :debug

When changing it to log_policy_breakdowns: :warning, this log entry changes from an info to a warning level:

20:00:26.029 request_id=F8qg_y1LnSpDpzwAAA2B [warning] GF.Carts.PaymentMethodInput.create

I tried bypassing ash_graphql, writing a test that only calls Ash.Changeset and my Ash API module, but there was no authorization error, and I’m not sure I’m setting it up the same way that ash_graphql is.

Without a policy breakdown, and no details in the logs, how does one go about troubleshooting this issue?

Showing Posts 1 to 2

moxley

moxley OP

I figured it out. It was related to that log entry I mentioned before, for GF.Carts.PaymentMethodInput.create. GF.Carts.PaymentMethodInput is an embedded resource. It had Ash.Policy.Authorizer configured as the authorizer, but there were no policies configured in that resource, nor should there be. By removing Ash.Policy.Authorizer from the resource configuration, the errors went away.

I would have been helpful if the logs indicated that no policies were set.

zachdaniel

zachdaniel

Creator of Ash

Yeah, that is some low hanging fruit DX that should have been addressed a long time ago. Will look into it today :slight_smile:

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews