I am working on a web platform using Nuxt 3 and Notion as my backend through the official API. I use it through this SDK : https://www.npmjs.com/package/@notionhq/client Everything is working great on localhost:3000 but when I deploy my website to Vercel, I have this error message :
WARN @notionhq/client warn: request fail { code: 'unauthorized', message: 'API token is invalid.' }
It is really strange because I have the same NOTION_API_KEY
(as localhost) inside my .env
...
Here is my package.json
:
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"@nuxtjs/supabase": "^0.1.16",
"@nuxtjs/tailwindcss": "^5.1.2",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.2",
"nuxt": "3.0.0-rc.4",
"sass": "^1.53.0",
"sass-loader": "^10.3.0"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/vue-fontawesome": "^3.0.1",
"@headlessui/vue": "^1.6.4",
"@heroicons/vue": "^1.0.6",
"@notionhq/client": "^2.2.1",
"highlight.js": "^11.6.0",
"vue-gtag-next": "^1.14.0"
}
}
Have you ever encountered this scenario?
My Notion Token is invalid on production but working on localhost.