Closed opr-inzn closed 1 month ago
Hi @opr-inzn
Can you share more details of your sanity.config?
Just asking two obvious questions: 1) Did you add it to the plugins array?
export default defineConfig({
// ...
plugins: [
// ...
vimeoField({
accessToken: process.env.SANITY_STUDIO_VIMEO_ACCESS_TOKEN,
}),
],
})
2) The env is named SANITY_STUDIO_VIMEO_ACCESS_TOKEN
, right? Did you restart the server after adding the env?
If it is still not working: What Sanity version are you on?
Hey @marco-land! This is my sanity.config
plugins: [
structureTool({ structure }),
// Vision is for querying with GROQ from inside the Studio
// https://www.sanity.io/docs/the-vision-plugin
process.env.NODE_ENV === 'development' && visionTool({ defaultApiVersion: apiVersion }),
media(),
vimeoField({
accessToken: process.env.SANITY_STUDIO_VIMEO_ACCESS_TOKEN,
}),
].filter(Boolean) as PluginOptions[],
It is saved as SANITY_STUDIO_VIMEO_ACCESS_TOKEN in my env.local as well! In Sanity, it shows up like this:
I‘m on Sanity 3.54. Generating the token happens on developer.vimeo.com, right? Hope we can figure it out!
Do I need a paid account for this to work maybe?
Do I need a paid account for this to work maybe?
Yes, you definitely need a paid account since Vimeo won't give you access to the direct video files with a free account.
But the plugin should have still been able to access your api key from the .env
file.
I have the same issue. There's not much to share here since I followed the instructions just like @opr-inzn. When I do console.log in the sanity.config, the env variable shows up correctly. But for some reason the plugin won't pick it up?
Sanity version ^3.55.0
It is hard to debug / help without seeing any of your settings. Could you share your sanity config?
Meanwhile, I've just tested with sanity@3.57.3
, also with sanity@3.55.0
and sanity-plugin-vimeo-field@1.0.1
and have no issues…
Here's the setup:
.env
in sanity root -- I've tested with .env
and not .env.local
SANITY_STUDIO_VIMEO_ACCESS_TOKEN="YOUR_TOKEN"
Make sure the var SANITY_STUDIO_VIMEO_ACCESS_TOKEN
is spelled correct.
sanity.config.ts
export default defineConfig({
// … your other settings
plugins: [
vimeoField({
accessToken: process.env.SANITY_STUDIO_VIMEO_ACCESS_TOKEN,
}),
],
})
@opr-inzn did you still have issues?
Hey @marco-land, yes, I couldn't get it to work. Is it possible our issues are related to Embedded Studio in NextJS? I have sent an invitation to a demo repo for you to check out with my .env files.
Hey @marco-land, yes, I couldn't get it to work. Is it possible our issues are related to Embedded Studio in NextJS? I have sent an invitation to a demo repo for you to check out with my .env files.
Thanks for the invite, that was helpful.
In deed, it is a Embedded Studio Problem with NextJS in your case. I've sent you a PR that hopefully works now.
In general, the plugin will move on from using environmental variables to using sanity studio secrets as suggested here https://github.com/marco-land/sanity-plugin-vimeo-field/issues/1 -- I hope to get that in asap…
@marcobarbosa Are you also using a embedded studio (with NextJS) by any chance?
Thanks Marco, that's working now for me!
Hey @marco-land, yes, I couldn't get it to work. Is it possible our issues are related to Embedded Studio in NextJS? I have sent an invitation to a demo repo for you to check out with my .env files.
Thanks for the invite, that was helpful.
In deed, it is a Embedded Studio Problem with NextJS in your case. I've sent you a PR that hopefully works now.
In general, the plugin will move on from using environmental variables to using sanity studio secrets as suggested here #1 -- I hope to get that in asap…
@marcobarbosa Are you also using a embedded studio (with NextJS) by any chance?
@marco-land Yes, embedded studio here too :)
So I've added a token to my .env.local as described here: https://github.com/marco-land/sanity-plugin-vimeo-field/issues/6 and in sanity.config I have:
however, the vimeo field still shows No SANITY_STUDIO_VIMEO_ACCESS_TOKEN found! What is my mistake?