@hono/auth-js [auth][error] UnknownAction: Cannot parse action at /api/auth/providers.
when i try any endpoints on api/auth i get this error and i cant fix it
tried deffrent actions like signin ,signup,session,providers all will get same error
Error text
<-- POST /api/auth/providers
[auth][error] UnknownAction: Cannot parse action at /api/auth/providers. Read more at https://errors.authjs.dev#unknownaction
at parseActionAndProviderId (/mnt/F/myhonoserver/node_modules/.pnpm/@[email protected]/node_modules/@auth/core/lib/utils/web.js:94:19)
at <anonymous> (/mnt/F/myhonoserver/node_modules/.pnpm/@[email protected]/node_modules/@auth/core/lib/utils/web.js:25:40)
my code at app.ts ` const app = new Hono<{ Bindings: CloudflareBindings }>();
connectDB() app .use('', logger(), prettyJSON(), cors({ origin: '', allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], })) .use('/', timeout(5000)) .use( '', initAuthConfig((c) => ({ secret: process.env.AUTH_SECRET, basePath: 'api/auth',//also without same problem providers: [ Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET, }), ], })) ).use('/api/auth/', authHandler()) .use('/public/*', serveStatic({ root: '../public' })) .route("/api", api) .get('/', clientRoute)
export default app;
export type ApiRoutes = typeof api `
i tried to so many things like change base path or remove it .
I think there is a problem with latest versions, i tried to update my dependencies and I have the same error.
It's working with these versions :
"@auth/core": "0.28.1",
"@hono/auth-js": "1.0.3",
"hono": "^4.6.14",
},
I'm investigating and it's working when setting the basePath in the auth config :
initAuthConfig((c) => ({
basePath: "/api/auth",
I think the problem came with this commit https://github.com/honojs/middleware/commit/3d78fa470d45be86e55a7a9aa5e7a79e3fed20ec , the property basePath is no longer set by default so you have to do it yourself in the auth config.
So I think that the readme has to be updated and maybe the property basePath has to be required and not optional.
Can a maintainer can confirm this ?
I can reproduce. I am also using .basePath(/api) in my app.
When i use hono/authjs <1.0.9 I have no issues. Anything above this version and I get the error UnknownAction: Cannot parse action at just like @ayoubqrt
Same with me, I have issue like you this UnknownAction: Cannot parse action at /api/auth/providers or /api/auth/signin. Then finally i found solution based on bro @noqcks, downgrade your version @hono/auth-js. In my latest version 1.0.15 to become ----->>>> 1.0.8 version. Thanks its work for me, hopely it work for you.
I'm investigating and it's working when setting the
basePathin the auth config :initAuthConfig((c) => ({ basePath: "/api/auth",I think the problem came with this commit 3d78fa4 , the property
basePathis no longer set by default so you have to do it yourself in the auth config.So I think that the readme has to be updated and maybe the property
basePathhas to be required and not optional.Can a maintainer can confirm this ?
Thanks this work!