I’m building a website with Nuxt 3 that connects to Notion using their official client library. The setup works perfectly when I run it locally, but after deploying to Vercel I keep getting this error:
ERROR @notionhq/client error: authentication failed { status: 'unauthorized', description: 'Invalid API token provided.' }
This is confusing because I’m using the exact same NOTION_TOKEN environment variable in both environments. I’ve double-checked that the token is correctly set in my production .env file.
Here’s my current package.json configuration:
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"@nuxtjs/supabase": "^0.1.20",
"@nuxtjs/tailwindcss": "^6.0.1",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.4",
"nuxt": "3.1.1",
"sass": "^1.54.0",
"sass-loader": "^13.0.2"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.2.0",
"@fortawesome/free-brands-svg-icons": "^6.2.0",
"@fortawesome/free-regular-svg-icons": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/vue-fontawesome": "^3.0.2",
"@headlessui/vue": "^1.7.3",
"@heroicons/vue": "^2.0.12",
"@notionhq/client": "^2.2.3",
"highlight.js": "^11.7.0",
"vue-gtag-next": "^1.14.0"
}
}
Has anyone dealt with this kind of issue before? The Notion API token works locally but fails in production deployment.