Skip to content

[aws-amplify] Can't use native node:sqlite implementation on Amplify #3589

@antalasztrik

Description

@antalasztrik

Is your feature request related to a problem? Please describe

When trying to statically generate a lot of pages (350+) we ran into an issue, where some pages wouldn't get pre-rendered. In the build logs we found some lines that indicated that there is a problem with our SQLite db:

  • 2025-10-30T10:09:46.951Z [WARNING]: [error] Failed to execute SQL INSERT INTO _content_info VALUES ('checksum_XYZ', false, 'Pa7CrgJJaD4QDj2tA5Aa1fBsFeNWQoZj6Qg3fp83yrc', 'v3.5.0--7-zYv-DKz3BK19q0UotPW_pKZn8L7iqWiEW9NESIvoU', 'LrPDg5JwY_7Sv0VaNBgS0amTMfOq9glrFxZh5Ge2HCQ'); -- meta: SQLITE_BUSY: database is locked
  • 2025-10-30T10:09:47.514Z [WARNING]: [error] Failed to execute SQL CREATE TABLE IF NOT EXISTS _content_XYZ (id TEXT PRIMARY KEY, "extension" VARCHAR, "meta" TEXT, "stem" VARCHAR, "__hash__" TEXT UNIQUE); -- structure: SQLITE_BUSY: database is locked
  • and then a bunch of [WARNING]: [error] [unhandledRejection] SQLITE_BUSY: database is locked when trying to pre-render some of the pages.

This only happens with prod data, where some of the JSON files are over 1.7MB in size, with much smaller test data we get no errors, so most likely the problem is not in our code. We were also able to reproduce these errors in a local environment, so it's not just Amplify.

Describe the solution you'd like

Right now there is no way to use the native node:sqlite implementation in an Amplify environment, because of this line: https://github.com/nuxt/content/blob/main/src/presets/aws-amplify.ts#L20.

We haven't found any documentation on why sqlite3 is a hard requirement for Amplify and why the native node implementation wouldn't work. Since Amplify supports Node version 22, would it make sense to re-visit if this dependency is really needed for those environments?

Describe alternatives you've considered

We manually throttled our pre-render speed in the Nitro config, which seemed to help. We still get some SQLITE_BUSY errors, but we assumed it works on one of the re-tries Nitro does when the initial pre-render fails. So with this option all of our pages are properly generated, but manually throttling the rendering doesn't seem like the best solution.

We also tried the native node:sqlite implementation with the experimental.sqliteConnector option in our local environment and the errors were completely gone. So it looks like the issue comes from the sqlite3 dependency.

Additional context

If sqlite3 is not installed, we have this error when building the project:
2025-10-31T13:11:24.376Z [WARNING]: [error] [@nuxt/content] Nuxt Content requires sqlite3module to work in AWS Amplify environment. Please runnpm install sqlite3 to install it and try again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions