auth.strategy "custom" needs an auth export in steps/auth.ts, and I wrote one
Asked 3,610 views1 answer
10votes
Our login is a two-step form — email, continue, then password on the next screen — so the four selectors in auth.form do not cover it. Set the strategy to custom and wrote the file:
text
✖ CONFIG_INVALID: auth.strategy "custom" needs an `auth` export in projects/shop/steps/auth.ts.
hint: export const auth = defineAuth({ strategy: 'custom', login: async ({ page, user }) => { ... } })
projects/shop/steps/auth.ts exists and exports auth. It is a defineAuth call with strategy: 'custom' in it. What is it looking for that I have not given it?
A login function. The loader imports steps/auth.ts (also steps/auth.js, also auth.ts at the project root), takes the auth export or the default export, and then checks that it has a callable login. Anything without one is ignored — it falls through to deriving a strategy from the yaml, and custom has nowhere to derive to, which is the error you are reading.
So the object is being found and rejected, not missed. Usual cause is a defineAuth({ strategy: 'custom' }) with the login still to be written, or the login living on some other key.
Return the context and SDODS saves the storage state and closes it. user is the leased pool account, so the two-step form gets the same credentials the pool would have handed a form strategy.