N
Nuxt3mo ago
JC

Nuxt studio cannot access preview

I cannot access preview on Nuxt studio, I already have mine deployed I could see the __preview.json file with data but when I try and navigate to the ?preview=<id> it goes into loading loop with an error of: Uncaught (in promise) SQLite3Error: SQLITE_ERROR: sqlite3 result code 1: no such table: _content_pages. I opened my contents.sqlite file I could see that the table _content_pages is present with data anybody have encountered this issue?
32 Replies
kapa.ai
kapa.ai3mo ago
Hi @Psi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It sounds like preview mode is enabled but the Content v3 database isn’t being loaded in the environment serving your preview URL. Checklist to resolve: - Ensure Preview API is enabled in your Nuxt config and the metadata is reachable: - nuxt.config.ts:
export default defineNuxtConfig({
content: {
preview: { api: '<https://api.nuxt.studio'> }
}
})

export default defineNuxtConfig({
content: {
preview: { api: '<https://api.nuxt.studio'> }
}
})

- Visit /preview.json on your deployed site; if Studio can’t validate git info, set preview.gitInfo explicitly (owner/name/url) (visit the guide) (Enable the Full Editing Experience).
- Verify your deployment preset matches your host and that the build runs nuxi build so the Content dump is generated and restored at runtime. For server hosting (Node preset), run the built server with node .output/server/index.mjs; for serverless, follow the platform guides so the dump is restored into the selected adapter on cold start (Server Hosting, Deploy with Serverless).
- If you’re on AWS Amplify, install sqlite3 so Content can auto-configure and store the SQLite file under /tmp (required on Lambda-like environments). Without this, the DB may fail to initialize at runtime and queries will error as “no such table” even if your local DB shows tables: - Install sqlite3 in your project and redeploy; Content auto-detects Amplify and configures the DB at /tmp (or override filename to /tmp/contents.sqlite) (AWS Amplify, Deploy with Serverless). - If using a different serverless provider, pick a supported adapter (D1, Postgres, LibSQL) and set content.database accordingly, then deploy with nuxi build so the dump is restored on cold start (Deploy with Serverless, database config).
- Locally, if your DB is out of sync, clean and regenerate to confirm preview works: - npx nuxi cleanup && npx nuxi dev - If needed, delete .data/content/contents.sqlite and restart dev (Tools). Why you see “no such table: _content_pages”: - In v3, tables are generated and then restored from the dump on first content query. If the runtime DB isn’t initialized (e.g., missing connector in serverless, wrong writable path, or mismatch between build and runtime), queries can hit an empty/absent DB even though your local contents.sqlite shows the table (Database, Deploy with Serverless, AWS Amplify). After fixing the runtime DB setup, try the preview URL again (?preview=true or your Studio link). If Studio still can’t connect, re-check /
preview.json and gitInfo as noted above (Enable the Full Editing Experience). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
I have the preview api as you mentioned, I already added the gitInfo explicitly and I saw that the it is running the correct command node .output/server/index.mjs, I am on render and I could that there is a file on the deployed environment .data/content/contents.sqlite I also tried running npx nuxi cleanup && npx nuxi dev I also deletd the .data/content/contents.sqlite I still see the same error @kapa.ai @kapa.ai My storage driver is undefined do you have any idea how to solve this?
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I’m sorry, but the knowledge sources don’t mention an error like “storage driver is undefined,” so I can’t confirm a specific fix. Closest related points you can verify: - If this is about Nitro server storage, ensure you’ve actually mounted a storage driver via nitro.storage in nuxt.config or a server plugin before calling useStorage(name). Example Redis mount: configure nitro.storage, then useStorage('redis') in your handler (Server storage).
- If this is about Nuxt Content v3’s SQL storage, make sure a valid database adapter is configured and available in your runtime (sqlite by default, or d1/postgres/libsql). Missing/incorrect adapter can cause runtime storage issues (database). You can also select a SQLite connector explicitly via experimental.sqliteConnector if needed (experimental).
- For preview with Studio, confirm preview is enabled so the Preview API endpoint works (/__preview.json), which indicates Content’s storage is wired up in your deploy environment (Enable preview, Studio setup). If you can share where the error appears (Nitro useStorage, Content DB init, or Studio preview) and a snippet of your config/handler, I can map it to the exact setup from the docs. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I could see the __preview.json just fine, but unable to view the pages due to the error of Uncaught (in promise) SQLite3Error: SQLITE_ERROR: sqlite3 result code 1: no such table: _content_pages
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- That error means the Content v3 SQL database wasn’t restored/initialized in your deployed runtime, so queries run against an empty DB (hence “no such table: _content_pages”), even though your local contents.sqlite has the table. Fix checklist: - Ensure Preview API is enabled and reachable (you already see /__preview.json). If Studio validation fails, set preview.gitInfo explicitly in nuxt.config.ts (only if needed) (Enable preview, preview config). - Verify your deployment preset and that you build with nuxi build, so the dump gets generated and restored on cold start: - Node hosting: run node .output/server/index.mjs after build (Server hosting). - Serverless: pick and configure a supported adapter and redeploy (D1, Postgres, LibSQL, or SQLite with writable path), e.g.:
export default defineNuxtConfig({
content: {
database: { type: 'libsql', url: process.env.TURSO_DATABASE_URL, authToken: process.env.TURSO_AUTH_TOKEN }
}
})

export default defineNuxtConfig({
content: {
database: { type: 'libsql', url: process.env.TURSO_DATABASE_URL, authToken: process.env.TURSO_AUTH_TOKEN }
}
})

For Lambda-like platforms, ensure SQLite filename is under /tmp:
content: { database: { type: 'sqlite', filename: '/tmp/contents.sqlite' } }

content: { database: { type: 'sqlite', filename: '/tmp/contents.sqlite' } }

(Serverless deploy, database config). - If you rely on SQLite on Node, confirm the connector works in your environment. You can force a connector:
content: { experimental: { sqliteConnector: 'native' } }

content: { experimental: { sqliteConnector: 'native' } }

(Node 22.5+), or rely on better-sqlite3/sqlite3 per environment (experimental sqliteConnector). - Local sanity check: clean and regenerate the DB to rule out corruption, then test preview locally: - npx nuxi cleanup && npx nuxi dev - If needed, delete .data/content/contents.sqlite and restart (Debug tools). Why this happens: in v3 the DB tables are created at build and restored on first query. If the runtime can’t restore (wrong adapter, missing writable path, or mismatch between build and deploy), queries fail with “no such table,” even though the table exists in your local DB (Database flow, Serverless notes). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I already done those steps but I still get the same error, although I saw that we use nuxt build to generate our app but I manually run the nuxi cleanup and nuxi build to regenerate the said files
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Given you rebuilt, the error still points to the runtime DB not being restored where your app is deployed. Targeted checks: - Confirm your deploy preset and how the server runs: - Node hosting: deploy the Node preset output and start with node .output/server/index.mjs (not a dev/serverless runner) so the dump is restored on first query (Server Hosting) (Server hosting).
- Serverless: you must configure a compatible adapter and environment so the dump can be restored on cold start. For example: - Cloudflare Workers: D1 with bindingName set.
- Vercel/others: Postgres or LibSQL configured via env vars.
- Lambda-like (only /tmp writable): SQLite filename must be under /tmp.
Redeploy after setting content.database accordingly (Deploy with Serverless, database). - Ensure a working SQLite connector in your environment. If on Node 22.5+, force native to avoid binary issues:
export default defineNuxtConfig({
content: { experimental: { sqliteConnector: 'native' } }
})

export default defineNuxtConfig({
content: { experimental: { sqliteConnector: 'native' } }
})

Otherwise rely on better-sqlite3/sqlite3 per environment (Experimental connectors) (experimental). - Verify the dump-restore flow actually runs in your deploy: - The database is generated at build and restored on first query. If the restore can’t write or the adapter can’t connect, queries hit an empty DB and you get “no such table: _content_pages” (Database).
- On serverless, also ensure your build command is nuxi build (so the dump is packaged) and that the platform preset is used (Nuxt auto-adjusts) (Serverless deploy). - Quick isolation: temporarily switch to a remote adapter (e.g., LibSQL/Turso) to avoid writable-path issues:
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})

export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})

If this fixes preview, your prior runtime couldn’t restore/write the SQLite DB (database). - Studio itself is fine if /__preview.json loads. Keep preview enabled as you have it; set preview.gitInfo if Studio validation complains, but this won’t fix the SQL error—it must be solved at the runtime DB layer (Studio setup, preview config). If you share your hosting platform and current content.database config, I can map the exact required adapter/bindings from the docs. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai we don't have configuration on content.database and we use Render for hosting
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- On Render (Node server hosting), you should run the Node preset output and let Nuxt Content restore its SQLite DB on first query. Two key points: 1) Ensure you are actually running the built server - Build: npx nuxi build - Start: node .output/server/index.mjs If you start differently, the dump may not restore and queries hit an empty DB, causing “no such table: _content_pages” (Server hosting).
2) Provide a working SQLite connector in your Render runtime - By default, Content uses SQLite. In some environments, native/binary connectors can fail. On Node 22.5+, you can force the native connector:
export default defineNuxtConfig({
content: { experimental: { sqliteConnector: 'native' } }
})

export default defineNuxtConfig({
content: { experimental: { sqliteConnector: 'native' } }
})

Otherwise ensure better-sqlite3 is installable in Render’s build (or try sqlite3). This avoids restore failures that manifest as “no such table” (experimental sqliteConnector, Database flow). If the issue persists on Render (e.g., write restrictions), switch to a remote adapter so restore doesn’t rely on local files:
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})
or a managed Postgres:
export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})
export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})
This is the recommended path for serverless-like environments; the dump will be restored into the external DB on cold start (database adapters, Serverless deploy). You already have preview enabled since /__preview.json works; that part is fine. The loop comes from the DB not being restored at runtime. After adjusting the connector/adapter and ensuring the proper start command, redeploy and try the Studio preview again (Studio setup). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I updated my content.database configuration to use postgresql but it seems that I still get the error Uncaught (in promise) SQLite3Error: SQLITE_ERROR: sqlite3 result code 1: no such table: _content_pages
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- It means your deployed app is still using a SQLite connector at runtime (or restoring into a local SQLite DB) instead of connecting to PostgreSQL, so the Content tables aren’t there and queries hit an empty/missing SQLite DB. Checks to align runtime with Postgres: - Verify nuxt.config.ts really sets the Postgres adapter and is included in the deployed build:
export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})

export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})

Ensure POSTGRES_URL is present in the deploy environment, not just locally (Database > Postgres).
- Rebuild and run the Node preset output: - Build: nuxi build - Start: node .output/server/index.mjs The database dump is generated at build and restored “on first query” into the configured adapter. If your process starts differently, restore may not happen as expected (Server hosting, Database flow).
- Remove/override any leftover SQLite settings: - Ensure there is no content.database.type: 'sqlite' or filename override for production. - If you previously set experimental.sqliteConnector, remove it so the Postgres adapter is used (experimental).
- Confirm Postgres connectivity at runtime: - Install pg (build dependency) and redeploy. - Check logs on cold start for restore; the dump should be imported into Postgres on first content query (Database > Postgres, Database flow). - If on a serverless-like preset by mistake, ensure you’re on the Node server preset for Render (or keep Postgres configured; both work). The important part is that the adapter matches the environment so restore doesn’t fall back to SQLite (Serverless deploy).
Why you still see a SQLite error: some part of the runtime still initializes a SQLite connector (default) and queries against it. Once the app truly runs with content.database.type = 'postgres' and POSTGRES_URL set, the “first query” will restore tables into Postgres, and the _content_pages table will exist there; the SQLite error will disappear (Database flow, Database config). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai Here is my content.database content: { database: { type: 'postgres', url: 'postgresql://postgres:mydb@localhost:65433/ps', }, I can connect to that using my pgadmin with no problem
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Thanks. Two things to verify from the docs so Postgres is actually used at runtime: - Ensure the pg package is installed in your project and available in Render’s build. Nuxt Content requires it when using the Postgres adapter (otherwise it can fall back/error and you’ll still see SQLite errors): - Install pg and redeploy (Database > Postgres) (Postgres adapter). - Make sure the Postgres URL is provided via environment variable in production and included in the built app: - nuxt.config.ts
export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})

export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})

- Set POSTGRES_URL in Render’s env vars to the same connection string you tested. Rebuild with nuxi build and run node .output/server/index.mjs so the dump restores into Postgres on first query (Server hosting, Database flow). If you still see a SQLite error after that, it indicates the runtime is not using the Postgres adapter (or the URL is missing), so Nuxt Content defaults to SQLite. Double‑check there’s no leftover content.database.type: 'sqlite' or experimental sqliteConnector setting in production, and confirm logs show restore into Postgres on cold start (Database adapters, Database). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I added the pg and rebuild using nuxi build I still get the sqlite error
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Given you installed pg and rebuilt, the error still indicates your deployed runtime is not actually using the Postgres adapter and is falling back to SQLite. Quick checks from the docs: - Ensure your production config points to Postgres via env var (not a localhost URL) and that the variable exists on Render:
export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})

export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL
}
}
})

Then set POSTGRES_URL in Render to your remote Postgres connection string and redeploy. The Postgres adapter requires the pg package, which you’ve installed (Database > Postgres).
- Start the built Node server (not dev) so the dump can be restored on first content query: - Build: nuxi build - Start: node .output/server/index.mjs This is the expected flow for server hosting; the dump is restored into the configured DB on first query (Server Hosting, Database flow).
- Remove any leftover SQLite config/connector in production (e.g., experimental.sqliteConnector) so it can’t initialize a local SQLite DB instead of Postgres (experimental sqliteConnector). If the above is correct and you still see a SQLite error, switch temporarily to a managed adapter like LibSQL/Turso to confirm the issue is the runtime still using SQLite:
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})
If this works in Render, the previous deploy wasn’t actually connected to Postgres at runtime (Database adapters, Serverless deploy notes). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I removed everything related to the sqlite only left the buildDepencies better-sqlite3 I also tried and remove the content object from nuxt config but still I get the error of no such table __content_pages
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- That error means your deployed app is still querying a SQLite database that hasn’t been restored, so the _content_pages table doesn’t exist at runtime, even if it exists locally. In Content v3 the dump is generated at build and restored on first query into the configured adapter; if the adapter/env isn’t set correctly, queries hit an empty SQLite DB and throw “no such table” (Database flow). On Render (Node hosting), do this: - Ensure you run the built Node server: - Build: npx nuxi build - Start: node .output/server/index.mjs (don’t run dev) (Server hosting).
- Configure a real external database adapter for production and provide its env vars on Render. Example with Postgres: - Install pg. - nuxt.config.ts:
export default defineNuxtConfig({
content: { database: { type: 'postgres', url: process.env.POSTGRES_URL } }
})

export default defineNuxtConfig({
content: { database: { type: 'postgres', url: process.env.POSTGRES_URL } }
})

- Set POSTGRES_URL in Render and redeploy (Database: Postgres).
Alternatively use LibSQL/Turso or keep SQLite only if your host allows writing the DB file; serverless-like environments should use external DBs (Serverless deploy, Database adapters). - Remove any experimental SQLite connector overrides so the Postgres/libsql adapter is actually used in production (experimental sqliteConnector). - Verify the dump restore actually happens on first request after deploy (that’s when tables like _content_pages are created in the target DB) (Database flow). If you still see the SQLite error after switching to Postgres or LibSQL and redeploying with the proper start command, it indicates the runtime is not picking your production config or env var, and Nuxt Content defaults back to SQLite. Double‑check the env var is set on Render and that the process runs the built server. For static hosting, use nuxi generate; Content will load a WASM SQLite DB in the browser for client navigation (Static hosting). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I manually built the on render using nuxi build and run it via node .output/server/index.mjs but I still get the same behavior, I could see a message of Unauthorized preview but with the same error on the console log of SQLite3Error: SQLITE_ERROR: sqlite3 result code 1: no such table: _content_pages
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Two separate issues are showing up: 1) Unauthorized preview - Ensure Preview API is enabled in nuxt.config.ts and that Studio can validate your site. If needed, set preview.gitInfo so /preview.json passes the provider check (then redeploy) (Enable preview).
export default defineNuxtConfig({
content: {
preview: {
api: '<https://api.nuxt.studio',>
// optional if validation fails:
// gitInfo: { name: 'repo', owner: 'org', url: '<https://github.com/org/repo'> }
}
}
})

export default defineNuxtConfig({
content: {
preview: {
api: '<https://api.nuxt.studio',>
// optional if validation fails:
// gitInfo: { name: 'repo', owner: 'org', url: '<https://github.com/org/repo'> }
}
}
})

You should be able to open /
preview.json without “Forbidden error.” If you still get forbidden, follow the troubleshooting to override gitInfo (Enable the Full Editing Experience). 2) “no such table: _content_pages” - This means the Content v3 SQL database wasn’t restored in your Render runtime on first content query. Even with Node preset and nuxi build, if the adapter can’t initialize, queries fall back to an empty SQLite DB and that table isn’t present (Database). - On a Node server host like Render, keep using the Node preset but make sure a working DB adapter is configured for production: - Use SQLite only if the host allows writing and the connector works; otherwise configure a remote DB: - Postgres:
export default defineNuxtConfig({
content: { database: { type: 'postgres', url: process.env.POSTGRES_URL } }
})

export default defineNuxtConfig({
content: { database: { type: 'postgres', url: process.env.POSTGRES_URL } }
})

Install pg and set POSTGRES_URL in Render (Database > Postgres). - Or LibSQL/Turso:
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})

export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN
}
}
})

(Database > LibSQL). - Rebuild and start: - nuxi build - node .output/server/index.mjs The dump should be restored “on first query” into the configured adapter; from then, queries won’t touch SQLite and the _content_pages table will exist (Server hosting, Database). If the error persists: - Double‑check you don’t have leftover experimental.sqliteConnector forcing SQLite in production (Experimental). - Clean and regenerate locally to ensure the dump is valid: - npx nuxi cleanup && npx nuxi dev, or delete .data/content/contents.sqlite then rebuild (Tools). - If you deploy as static (nuxi generate), Content uses WASM SQLite in the browser, which is expected for SSG (Static Hosting). References: (Enable the Full Editing Experience](https://content.nuxt.com/docs/studio/setup#enable-the-full-editing-experience)), (Server hosting), (Database), (Database config), (Experimental sqliteConnector), (Debugging tools), (Static hosting). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JC
JCOP3mo ago
@kapa.ai I created a new fresh Nuxt project and wanted to test the studio I did a nuxi build and node .output/server/index.mjs on ym local machine and I get an unathorized preview with no error on sqlite
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- “Unauthorized preview” means preview mode is enabled but Studio hasn’t authorized your local site. Check these: - Ensure Preview API is enabled in nuxt.config.ts:
export default defineNuxtConfig({
content: {
preview: { api: '<https://api.nuxt.studio'> }
}
})

export default defineNuxtConfig({
content: {
preview: { api: '<https://api.nuxt.studio'> }
}
})

Then rebuild and run your local server (nuxi build && node .output/server/index.mjs). This exposes /preview.json, which Studio uses to validate your site (Enable preview, Enable the Full Editing Experience). - Verify /preview.json loads locally. If Studio can’t validate repo metadata, add gitInfo:
content: {
preview: {
api: '<https://api.nuxt.studio',>
gitInfo: {
name: 'your-repo',
owner: 'your-org',
url: '<https://github.com/your-org/your-repo'>
}
}
}

content: {
preview: {
api: '<https://api.nuxt.studio',>
gitInfo: {
name: 'your-repo',
owner: 'your-org',
url: '<https://github.com/your-org/your-repo'>
}
}
}

Then try connecting your site URL in Studio’s self‑hosted setup again (Enable the Full Editing Experience). - Use the correct preview URL trigger. Nuxt’s usePreviewMode enables preview when the URL has ?preview=true (or your custom param) and will refresh data automatically; the command nuxt preview is only to serve a built app and is unrelated to authorization with Studio (usePreviewMode, nuxt preview command). If /__preview.json is OK but Studio still shows “Unauthorized preview,” it’s likely a Studio-side validation issue (URL not configured, or gitInfo mismatch). Follow the troubleshooting in the Studio setup docs and override gitInfo as above, then reconnect the URL in Studio (Enable the Full Editing Experience). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@399430703810609152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?