Skip to content

Conversation

@antalasztrik
Copy link

πŸ”— Linked issue

#3589

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Attempt at running an Amplify build without the sqlite3 dependency, but instead using the native node:sqlite module from Node version 22.5+.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link

vercel bot commented Nov 4, 2025

@antalasztriksbt is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 4, 2025

npm i https://pkg.pr.new/@nuxt/content@3598

commit: 19c4697

})

try {
/* try {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the explicit sqlite3 module check creates a silent failure path for AWS Amplify builds that don't have Node.js 22.5+ or don't have better-sqlite3 installed. This could cause builds to hang on interactive prompts during CI/CD.

View Details
πŸ“ Patch Details
diff --git a/src/presets/aws-amplify.ts b/src/presets/aws-amplify.ts
index ef66032b..6445ceb1 100644
--- a/src/presets/aws-amplify.ts
+++ b/src/presets/aws-amplify.ts
@@ -1,5 +1,6 @@
 import { definePreset } from '../utils/preset'
 import { logger } from '../utils/dev'
+import { isNodeSqliteAvailable } from '../utils/dependencies'
 import nodePreset from './node'
 
 export default definePreset({
@@ -16,16 +17,23 @@ export default definePreset({
       }
     })
 
-    /* try {
-      await import('sqlite3')
-
-      options.experimental ||= {}
-      options.experimental.sqliteConnector = 'sqlite3'
+    // Ensure explicit SQLite connector to avoid interactive prompts in CI/CD
+    options.experimental ||= {}
+    
+    if (isNodeSqliteAvailable()) {
+      // Use native Node.js SQLite for Node.js 22.5+
+      options.experimental.sqliteConnector = 'native'
+    } else {
+      // For older Node.js versions, verify sqlite3 is available
+      try {
+        await import('sqlite3')
+        options.experimental.sqliteConnector = 'sqlite3'
+      }
+      catch {
+        logger.error('Nuxt Content requires `sqlite3` module to work in AWS Amplify environment with Node.js < 22.5. Please run `npm install sqlite3` to install it and try again.')
+        process.exit(1)
+      }
     }
-    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

Analysis

AWS Amplify preset causes interactive prompts in CI/CD when better-sqlite3 is missing

What fails: AWS Amplify preset with commented sqlite3 check falls back to ensurePackageInstalled('better-sqlite3') which calls logger.prompt() in CI/CD environments, causing builds to hang with "TTY initialization failed" error.

How to reproduce:

# In AWS Amplify environment with Node.js < 22.5 and missing better-sqlite3:
# 1. Use @nuxt/content with aws-amplify preset
# 2. Don't install better-sqlite3 dependency
# 3. Build in CI/CD environment (non-interactive)

Result: Build hangs waiting for user input on package installation prompt, then fails with TTY error.

Expected: Fast failure with clear AWS Amplify-specific error message, like the original commented code provided.

Root cause: findBestSqliteAdapter() fallback calls ensurePackageInstalled() which uses interactive prompts unsuitable for CI/CD environments when no explicit sqliteConnector is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants