Create documents with sanity module
Im trying to use the sanity module to create documents, but it returns insufficent permission. I have tested it with a curl on the endpoint with the same token and it lets me create and i have checked that the token is set. What could be the cause. Is it possible to log the outgoing requests auth token directly?
3 Replies
Hi @isakwang. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I understand you're having permission issues when trying to create documents with the Sanity module in Nuxt. Based on the knowledge sources provided, there isn't specific information about debugging Sanity module permission issues in Nuxt. However, I can suggest some approaches to troubleshoot this problem.
For debugging the outgoing request's auth token, you could use the
setLogLevel("debug")
approach that was mentioned in one of the Firestore examples. This technique might help you see more detailed logs about what's happening with your requests:
The Nuxt Image documentation shows that Nuxt has first-class integration with Sanity, but it focuses on image handling rather than document creation:
Sanity Provider Documentation
For debugging network requests in general, you might want to check the network tab in your browser's developer tools to see the actual requests being made, including headers and authentication tokens.
If you're using server-side requests, you could try implementing a similar approach to what was shown in one of the examples where they changed from using $fetch
to useFetch
, which made the requests visible in the Nuxt DevTools payload tab.
Unfortunately, the knowledge sources don't contain specific information about debugging Sanity module permission issues in Nuxt. You might want to check the official Sanity documentation for Nuxt integration or consider opening an issue in the relevant GitHub repository if you believe this is a bug with the module itself.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@234270188906741761> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I have for now ended up using the http endpoint directly, but would love some help as this is undocumentet in the module