siros123
siros123
AEAsh Elixir
Created by siros123 on 3/17/2023 in #support
key :current_user not found error in ash_authentication_phoenix tutorial sample home.html.heex
Hello, I have progressed with implementing https://ash-hq.org/docs/guides/ash_authentication_phoenix/latest/getting-started-with-ash-authentication-phoenix but unfortunately I get a key :current_user not found error when starting the server as in https://ash-hq.org/docs/guides/ash_authentication_phoenix/latest/getting-started-with-ash-authentication-phoenix#start-phoenix I have double checked the generated routes, the contents of the AuthController and the associated auth_html.ex and failure.html.heex. I can create a new user through localhost:4000/sign-in but then after I still get the same error. It seems the current_user simply does not get assigned. How can I debug this?
31 replies
AEAsh Elixir
Created by siros123 on 3/16/2023 in #support
How to solve "(Jason.DecodeError)" in Ash Authentication Phoenix tutorial
Hi everyone, I am going through the Ash Authentication Tutorial but I'm stuck on an obtuse error that gives me few clues where to debug it:
### my command
$ mix ash_postgres.generate_migrations --name add_user_and_token

### error output
Extension Migrations:
No extensions to install

Generating Tenant Migrations:

Generating Migrations:
** (Jason.DecodeError) unexpected byte at position 0: 0x60 ("`")
(jason 1.4.0) lib/jason.ex:92: Jason.decode!/2
(ash_postgres 1.3.16) lib/migration_generator/migration_generator.ex:2333: AshPostgres.MigrationGenerator.load_snapshot/1
(ash_postgres 1.3.16) lib/migration_generator/migration_generator.ex:433: anonymous fn/3 in AshPostgres.MigrationGenerator.deduplicate_snapshots/3
(elixir 1.14.1) lib/enum.ex:1662: anonymous fn/3 in Enum.map/2
(stdlib 4.1.1) maps.erl:411: :maps.fold_1/3
(elixir 1.14.1) lib/enum.ex:2480: Enum.map/2
(ash_postgres 1.3.16) lib/migration_generator/migration_generator.ex:294: anonymous fn/3 in AshPostgres.MigrationGenerator.create_migrations/3
(elixir 1.14.1) lib/enum.ex:980: anonymous fn/3 in Enum.each/2
### my command
$ mix ash_postgres.generate_migrations --name add_user_and_token

### error output
Extension Migrations:
No extensions to install

Generating Tenant Migrations:

Generating Migrations:
** (Jason.DecodeError) unexpected byte at position 0: 0x60 ("`")
(jason 1.4.0) lib/jason.ex:92: Jason.decode!/2
(ash_postgres 1.3.16) lib/migration_generator/migration_generator.ex:2333: AshPostgres.MigrationGenerator.load_snapshot/1
(ash_postgres 1.3.16) lib/migration_generator/migration_generator.ex:433: anonymous fn/3 in AshPostgres.MigrationGenerator.deduplicate_snapshots/3
(elixir 1.14.1) lib/enum.ex:1662: anonymous fn/3 in Enum.map/2
(stdlib 4.1.1) maps.erl:411: :maps.fold_1/3
(elixir 1.14.1) lib/enum.ex:2480: Enum.map/2
(ash_postgres 1.3.16) lib/migration_generator/migration_generator.ex:294: anonymous fn/3 in AshPostgres.MigrationGenerator.create_migrations/3
(elixir 1.14.1) lib/enum.ex:980: anonymous fn/3 in Enum.each/2
It looks like there is an error with a JSON file somewhere but I cannot tell which JSON file it should be and/or how I could find out. Can anyone give any pointers as to how to debug this? Sorry, I am quite a beginner in Elixir/Phoenix/Ash so I apologize if this has quite an obvious solution. I would just like to understand where to start fixing this.
10 replies