Undefined function api/1 when follow Getting Started Ash Authentication Phoenix guide

I have a green field Phoenix (1.7.12) application, and I’m following the “Getting Started Ash Authentication Phoenix” guide. I’m using all of the latest versions for Ash

 {:ash_authentication_phoenix, "~> 2.0.0-rc.2"},
 {:ash_authentication, "~> 4.0.0-rc.6"},
 {:ash_phoenix, "~> 2.0.0-rc.8"},
 {:ash_postgres, "~> 2.0.0-rc.14"},
 {:ash, "~> 3.0.0-rc.45"},

The problem that I’m facing is this error,

➜  mix ash_postgres.create                                                                       1 ↵
Compiling 19 files (.ex)
    error: undefined function api/1 (there is no such import)
    │
  7 │     api(Example.Accounts)
    │     ^
    │
    └─ lib/example/accounts/resources/token.ex:7:5: Example.Accounts.Token (module)

Not sure if it’s because it’s all rc versions, or perhaps there is something I could be missing?

Ah, that guide may not have been fully updated. You can remove that option entirely in 3.0. Would you mind opening an issue on ash authentication or a PR to remove that line?

Thanks for the immediate response Zach.

I will submit that PR.

1 Like

In addition to that one, there is also a call to the same function in User. Am I right to presume that one can be removed too?

1 Like

Any references to internal APIs (ie. not something like a GraphQL API) should be updated to be Domain, yes.

1 Like