"[error] UnknownAction" on getSession() in AuthJS
Hello, I have tried to follow the example here on using @solid-mediakit/auth: https://www.npmjs.com/package/@solid-mediakit/auth#server-side
I have implemented it as suggested but I am having trouble using
getSession()
. In previous versions I have used it in server-side db methods like this:
I have tried upgrading to something like:
And this is just called in a button onClick()
method on my frontend:
But the problem is that I get the following fairly generic error:
npm
@solid-mediakit/auth
An authentication utility library for Solid 2.. Latest version: 2.0.12, last published: 14 days ago. Start using @solid-mediakit/auth in your project by running
npm i @solid-mediakit/auth
. There are no other projects in the npm registry using @solid-mediakit/auth.3 Replies
So I tried extracting the session to its own function to sanity check myself:
And it crashed between
3
and 4
, i.e. on getSession()
.
This is all very confusing so I tried replicating it on a minimum working project. And there I kind of got it working, but I MUST use cache()
and createAsync()
exactly like in the example on: https://www.npmjs.com/package/@solid-mediakit/auth#server-side
And even then I get the same error when I navigate from "Protected" to "Index" (or back and forth a few times).
Here is the repo for the minimum project: https://github.com/zimonitrome/SolidStart-Prisma-AuthJS-example
@OrJDev Sorry to bother you. Maybe you can help me out.Just an FYI. Same error here:
https://discord.com/channels/722131463138705510/1254011498632708147/1254091696342438029
Doesn't mean your issue is the same.
Haha thanks!
Funnily enough I found the exact same fix just 10 minutes after your reply, but after an hour+ of digging 🙃
Nevertheless this finally fixed it! But it probably shouldn't need to.
@OrJDev this could be worth looking into if you ever run out of work :)
https://discord.com/channels/722131463138705510/1254011498632708147/1254172874663526440