status 200 with empty JSON
I am not logged in when doing the api call from my vs code but it's not returning unauthorized 401 but a 200 with an empty json?
14 Replies
What does user return? Is it a single object or array?
If it's an array you need to do
It looks like drizzle syntax which always returns an array is you use
.select
Also this is redundant, you can actually do this in the original db call and only make one database trip. I'd be happy to show you how
But I'm using the Clerk middleware so since I'm not connected, the code should stop here & throw an error:
You might need to start adding some console logs check and see what the code sees at each point to find out where it’s going wrong
If you want to share you code I can take a look but it won’t be until tomorrow when I get back on my computer
I added them but I don't see the console logs in my terminal?
Can you try to do
console.log(user + “ here”)
you should get that in your terminal
If not it’s not hitting that routeok seems like there is an issue with the ClerkMiddleware() because I see unauthorized 401 when I remove it (and the console logs works too when I remove it
Im not familiar with the clerk middleware I have never used Clerk
If you think there is an issue with the package itself please open an issue here https://github.com/honojs/middleware
GitHub
GitHub - honojs/middleware: monorepo for Hono third-party middlewar...
monorepo for Hono third-party middleware/helpers/wrappers - honojs/middleware
Found the issue I need 2x the same key "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY" & "CLERK_PUBLISHABLE_KEY" in a nextjs project
Thanks for picking that up! I did an inner join on the workflow table, you're right!
You can also use the query method. I prefer that because it will return a single object instead of an array. Here is an example from a project of mine
You just have to setup relationships in your model as shown here https://orm.drizzle.team/docs/rqb#one-to-one
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Then you don't have to worry about joins
Yeah I’m not a big fan of the query api, prefer the native sql (that’s why I picked drizzle over prisma)
But thanks for this idea! (Also I’m returning an array in this situation)
I get it I'm used to writing the SQL syntax as well. I recently found the query api and been using it and I like it in the fact is less work to do joins