amppA
Convex Communityβ€’2y agoβ€’
4 replies
ampp

Convex tests w/ ents with action identity issue.

Basically the recent updates seemed to mess with our tests. And seeing the docs were also expanded upon, and offering a bit more control so we refactored a bit, merging the ideas from the tests page on the main page and what we had working before with ents and auth.

We changed some code to use actions for the first time with a test, so the test was now breaking, and I verified the action that has a identity created - so asSarah.action(): that function then calls a ctx.runMutation() where ctx.viewerId is null within that.

However the actions ctx.auth.getIdentity() does return a value.

Just ctx.viewerId is empty in the child mutations, when its not in normal convex use. I understand that ctx on actions is not designed to get "middleware". Wondering if this is likely a setup issue or a bug.?

Wishlist: It's happened a couple of times but when you accidently call a t.mutation and its a action on the other side it would be nice if the error was more specific. I know I should work naming functions differently if they are been changed to action πŸ™ƒ . Its especially easy to mix up as most actions have ctx.runMutation inside..
Was this page helpful?