From d1ba2e1aa52a5d22e7916f3cc8e3bba15ee70c33 Mon Sep 17 00:00:00 2001 From: Asztrik Antal Date: Tue, 4 Nov 2025 13:29:50 +0100 Subject: [PATCH 1/4] feat: comment out sqlite3 import in the amplify preset --- src/presets/aws-amplify.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/presets/aws-amplify.ts b/src/presets/aws-amplify.ts index bc197eea2..e55b6b013 100644 --- a/src/presets/aws-amplify.ts +++ b/src/presets/aws-amplify.ts @@ -16,7 +16,7 @@ export default definePreset({ } }) - try { + /*try { await import('sqlite3') options.experimental ||= {} @@ -25,7 +25,7 @@ export default definePreset({ catch { logger.error('Nuxt Content requires `sqlite3` module to work in AWS Amplify environment. Please run `npm install sqlite3` to install it and try again.') process.exit(1) - } + }*/ }, async setupNitro(nitroConfig) { const database = nitroConfig.runtimeConfig?.content?.database From 19c469761108b5a35b7784b4da14f1b16642b380 Mon Sep 17 00:00:00 2001 From: Asztrik Antal Date: Tue, 4 Nov 2025 13:36:31 +0100 Subject: [PATCH 2/4] fix: fix lint errors --- src/presets/aws-amplify.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/presets/aws-amplify.ts b/src/presets/aws-amplify.ts index e55b6b013..ef66032bc 100644 --- a/src/presets/aws-amplify.ts +++ b/src/presets/aws-amplify.ts @@ -16,7 +16,7 @@ export default definePreset({ } }) - /*try { + /* try { await import('sqlite3') options.experimental ||= {} @@ -25,7 +25,7 @@ export default definePreset({ catch { logger.error('Nuxt Content requires `sqlite3` module to work in AWS Amplify environment. Please run `npm install sqlite3` to install it and try again.') process.exit(1) - }*/ + } */ }, async setupNitro(nitroConfig) { const database = nitroConfig.runtimeConfig?.content?.database From 07e3983d7539a7a74c6089ec76259cbd89c87992 Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Fri, 28 Nov 2025 14:51:38 +0100 Subject: [PATCH 3/4] fix(amplify): check for native sqlite existence Refactor SQLite connector handling in AWS Amplify preset. --- src/presets/aws-amplify.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/presets/aws-amplify.ts b/src/presets/aws-amplify.ts index ef66032bc..e0174488b 100644 --- a/src/presets/aws-amplify.ts +++ b/src/presets/aws-amplify.ts @@ -1,6 +1,7 @@ import { definePreset } from '../utils/preset' import { logger } from '../utils/dev' import nodePreset from './node' +import { isNodeSqliteAvailable } from '../utils/dependencies' export default definePreset({ name: 'aws-amplify', @@ -16,16 +17,21 @@ export default definePreset({ } }) - /* try { - await import('sqlite3') - + try { options.experimental ||= {} - options.experimental.sqliteConnector = 'sqlite3' + if (isNodeSqliteAvailable()) { + options.experimental.sqliteConnector = 'native' + } + else { + await import('sqlite3') + + options.experimental.sqliteConnector = 'sqlite3' + } } catch { logger.error('Nuxt Content requires `sqlite3` module to work in AWS Amplify environment. Please run `npm install sqlite3` to install it and try again.') process.exit(1) - } */ + } }, async setupNitro(nitroConfig) { const database = nitroConfig.runtimeConfig?.content?.database From ed284bca5aba283faf886d5ec2075a17d0197c44 Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Fri, 28 Nov 2025 15:08:14 +0100 Subject: [PATCH 4/4] docs: update AWS Amplify deployment instructions Added options for using native node:sqlite or sqlite3 in AWS Amplify setup. --- docs/content/docs/6.deploy/8.aws-amplify.md | 26 +++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/content/docs/6.deploy/8.aws-amplify.md b/docs/content/docs/6.deploy/8.aws-amplify.md index 5de3f5fe7..e47644ed6 100644 --- a/docs/content/docs/6.deploy/8.aws-amplify.md +++ b/docs/content/docs/6.deploy/8.aws-amplify.md @@ -6,8 +6,10 @@ description: Deploy your Content app to AWS Amplify ::card Quick Setup -- Install `sqlite3` package in your project. -- Go to AWS Amplify dashboard and create a new project using git repository and deploy the app. +- Prepare Sqlite Connector + - Option A (recommended on Node.js 22+): Use native `node:sqlite` + - Option B (legacy): Install `sqlite3` package in your project. +- Go to AWS Amplify dashboard and create a new project using your git repository and deploy the app. :: :hr @@ -15,6 +17,26 @@ Quick Setup Nuxt Content projects can be deployed to AWS Amplify with zero configuration. The module will automatically detect an AWS Amplify environment and will prepare the necessary configuration for deployment. +## Option A: Use native `node:sqlite` + +In order to use native `node:sqlite` package, you need to change node version to 22+. This can be easily done +in Amplify dashboard via `Build Settings` > `Live Package Updates` > `Package (Node.js version) = 22`. + +This is also possible via `amplify.yml` inside `preBuild` phase. + +```yml +frontend: + phases: + preBuild: + commands: + - nvm install 22 + - nvm use 22 + - node -v + - npm ci +``` + +## Option B: Use `sqlite3` + All you need to do is to install `sqlite3` package in your project and go to AWS Amplify dashboard and create a new project using git repository. That's it :tada: