I’ve got an app with multitenency and I’m trying to do a basic update on on resource via GraphQL using the default update action and I’m getting this error:
POST /gql
“superhotel.hotellite.local”
[debug] Processing with Absinthe.Plug
Parameters: %{“operationName” => “UpdateLodgingItem”, “query” => “mutation UpdateLodgingItem($updateLodgingItemId: ID!, $input: UpdateLodgingItemInput) {\n updateLodgingItem(id: $updateLodgingItemId, input: $input) {\n errors {\n code\n fields\n message\n shortMessage\n vars\n }\n result {\n checkInDate\n checkOutDate\n id\n name\n quantity\n rate\n subtotal\n tax\n taxRate\n total\n }\n }\n}”, “variables” => %{“input” => %{“checkInDate” => “2024-05-31”, “checkOutDate” => “2024-06-01”, “name” => “”, “paymentId” => “c252365d-b5c0-4b28-ad17-ccfb70b3d102”, “rate” => “100.0”, “taxRate” => “0.067”}, “updateLodgingItemId” => “0405f3b0-fe49-433d-8b7f-cc7c10b889bb”}}
Pipelines: [:graphql]
“Set tenant to superhotel”
[debug] ABSINTHE schema=App.GraphqlSchema variables=%{“input” => %{“checkInDate” => “2024-05-31”, “checkOutDate” => “2024-06-01”, “name” => “”, “paymentId” => “c252365d-b5c0-4b28-ad17-ccfb70b3d102”, “rate” => “100.0”, “taxRate” => “0.067”}, “updateLodgingItemId” => “0405f3b0-fe49-433d-8b7f-cc7c10b889bb”}
mutation UpdateLodgingItem($updateLodgingItemId: ID!, $input: UpdateLodgingItemInput) {
updateLodgingItem(id: $updateLodgingItemId, input: $input) {
errors {
code
fields
message
shortMessage
vars
}
result {
checkInDate
checkOutDate
id
name
quantity
rate
subtotal
tax
taxRate
total
}
}
}
[debug] QUERY ERROR source=“lodging_items” db=0.0ms queue=2.3ms idle=81.0ms
UPDATE “superhotel”.“lodging_items” AS l0 SET “payment_id” = s1.“payment_id”, “check_out_date” = s1.“check_out_date”, “check_in_date” = s1.“check_in_date”, “rate” = s1.“rate”, “tax_rate” = s1.“tax_rate”, “name” = s1.“name” FROM (SELECT $1::uuid AS “payment_id”, $2::date AS “check_out_date”, $3::date AS “check_in_date”, $4::decimal AS “rate”, $5::decimal AS “tax_rate”, $6::text AS “name” FROM “superhotel”.“lodging_items” AS sl0 WHERE (sl0.“id”::uuid = $7::uuid) LIMIT $8) AS s1 WHERE (l0.“id” = s1.“id”) RETURNING l0.“id”, l0.“name”, l0.“rate”, l0.“check_in_date”, l0.“check_out_date”, l0.“tax_rate”, l0.“payment_id” [“c252365d-b5c0-4b28-ad17-ccfb70b3d102”, ~D[2024-06-01], ~D[2024-05-31], Decimal.new(“100.0”), Decimal.new(“0.067”), nil, “0405f3b0-fe49-433d-8b7f-cc7c10b889bb”, 1]
↳ AshPostgres.DataLayer.update_query/4, at: lib/data_layer.ex:1411
[error] a85087ec-5abb-42a7-86d2-df0f5485f23d: Exception raised while resolving query.
** (Postgrex.Error) ERROR 42703 (undefined_column) column s1.id does not exist
query: UPDATE "superhotel"."lodging_items" AS l0 SET "payment_id" = s1."payment_id", "check_out_date" = s1."check_out_date", "check_in_date" = s1."check_in_date", "rate" = s1."rate", "tax_rate" = s1."tax_rate", "name" = s1."name" FROM (SELECT $1::uuid AS "payment_id", $2::date AS "check_out_date", $3::date AS "check_in_date", $4::decimal AS "rate", $5::decimal AS "tax_rate", $6::text AS "name" FROM "superhotel"."lodging_items" AS sl0 WHERE (sl0."id"::uuid = $7::uuid) LIMIT $8) AS s1 WHERE (l0."id" = s1."id") RETURNING l0."id", l0."name", l0."rate", l0."check_in_date", l0."check_out_date", l0."tax_rate", l0."payment_id"
hint: Perhaps you meant to reference the column "l0.id".
(ecto_sql 3.11.2) lib/ecto/adapters/sql.ex:1054: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.11.2) lib/ecto/adapters/sql.ex:952: Ecto.Adapters.SQL.execute/6
(ecto 3.11.2) lib/ecto/repo/queryable.ex:232: Ecto.Repo.Queryable.execute/4
(ash_postgres 2.0.6) lib/data_layer.ex:1411: AshPostgres.DataLayer.update_query/4
(ash 3.0.8) lib/ash/actions/update/bulk.ex:442: Ash.Actions.Update.Bulk.do_atomic_update/5
(ash 3.0.8) lib/ash/actions/update/bulk.ex:231: Ash.Actions.Update.Bulk.run/6
(ash_graphql 1.0.1) lib/graphql/resolver.ex:1224: AshGraphql.Graphql.Resolver.mutate/2
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
(absinthe 1.7.6) lib/absinthe/pipeline.ex:408: Absinthe.Pipeline.run_phase/3
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:536: Absinthe.Plug.run_query/4
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:290: Absinthe.Plug.call/2
(phoenix 1.7.12) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2
(phoenix 1.7.12) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
(app 0.1.0) lib/app_web/endpoint.ex:1: AppWeb.Endpoint.plug_builder_call/2