ERROR SQLite connection error: SQLITE_CANTOPEN: unable to open database file

netlify site name. Example: - endpoint

Hello Netlify Support Team,

I hope this message finds you well. I am reaching out regarding an issue I’m facing with my Netlify deployment involving a SQLite database within a Lambda function. I would greatly appreciate your assistance in resolving this matter.

Problem Description: I am encountering an ‘SQLITE_CANTOPEN’ error when attempting to open an SQLite database within my Netlify Lambda function. This issue is preventing the Lambda function from accessing the database and is causing my application to malfunction.

Reproduction Steps:

  1. I have developed a Node.js application that uses an SQLite database to store and retrieve data.
  2. The application works flawlessly when run locally.
  3. However, after deploying the application to Netlify, I am consistently encountering the ‘SQLITE_CANTOPEN’ error.

Expected vs. Actual Behavior: I expected the SQLite database to function as it does locally, allowing my Lambda function to interact with it on Netlify. However, the database connection is failing, resulting in the mentioned error.

Error Message: The exact error message I’m encountering is:
ERROR: SQLite connection error: SQLITE_CANTOPEN: unable to open database file

Code Snippets: Here is a simplified version of my code where I initialize and connect to the SQLite database within the Lambda function:
const sqlite3 = require(‘sqlite3’).verbose();
const dbPath = ‘/var/task/heroes.db’;

const connectToDB = () => {
const db = new sqlite3.Database(dbPath, (err) => {
if (err) {
console.error(‘SQLite connection error:’, err.message);
} else {
console.log(‘Connected to the SQLite database’);

// Additional database initialization code...

return db;


Deployment Details:

Runtime Version: nodejs:18.v10
Deployment Method: Netlify Deploy

Troubleshooting Steps Taken:

Checked the database file path, which seems correct.
Verified that the database file is being included in the deployment package.
Examined deployment logs for any relevant information.
Consulted online resources and community forums for potential solutions.

Request for Assistance:
I kindly request your expert assistance in diagnosing and resolving this issue. My application heavily relies on this database functionality, and I am eager to ensure its smooth operation on Netlify.
Contact Information: Please feel free to contact me at or [your-phone-number] for any further clarification or details you might need.

Thank you for your time and support. I look forward to your response.

Best regards, Marina

How did you verify this?

You most likely need this: How to Include Files in Netlify Serverless Functions