Error when using clerk getAuth from UploadThing routes
Dear All, I'm having problem using clerk and uploadthing.
NextJs: version 13.4.4
React:18.2.0
Uploadthing:5.2.1
Typescript:5.1.6
And using the pages router of nextjs.
I tried to isolate the issue as such:
I have the uploadthing endpoint and a dummy enpoint using both clerck
getAuth(req)
.
dummy.ts
`
uploadthing.ts
8 Replies
upload-routes.ts:
When trying to upload a file I'm getting this error:
when calling dummy.ts I'm getting the userid. I'm also using
getAuth
from several other APIs and from my TRPC endpoints...Everything works as expected.
middleware.ts:
Any idea?Is this pages or app dir
If pages
https://discord.com/channels/966627436387266600/1102510616326967306/1131994817245741107
If app dir, use
auth
not getAuth
Hi @Josh Thanks for pointing to the solution. I'm happy to see It is not coming from something I did wrong.
I did try to apply the solution but I'm getting another error now client side.
Yes pages dir
I can see it is related to the same error. I'll follow the topic on the uploadthing channel. Meanwhile I will remove the security for development. Going to production next month. We were planning to use uploadthing but if we do not get a proper solution we will have to drop our subscription and implement something ourselves. I would realy want to avoid to do that 😦
What's your front end code look like
This looks more like a miss configuration than something wrong with ut
I'll check tomorrow. But the upload works with the previous routes handler and no getAuth...
I am getting the same error, is there any fix yet for the required string array