Skip to main content

Error 409 in checkout

To provide the most frictionless onboarding and quickstart, Medusa uses SQLite as the server's database by default. SQLite runs on all machines and operating systems. So, it allows you to get quickly started without installing PostgreSQL.

However, this comes at the expense of important features that are needed in a production environment.

Therefore, you might experience the following error when going through a checkout flow in one of Medusa's starters while using SQLite:

Error: Transaction already started for the given connection, commit current transaction before starting a new one.
Copy to Clipboard

This error occurs because SQLite does not allow for multiple write transactions at the same time. To resolve it, you need to use PostgreSQL instead.

You can learn how to install PostgreSQL on your machine in the Set Up your Development Environment documentation.

Then in your medusa-config.jsCopy to Clipboard, you should change the project configuration to use Postgres as the database type:

medusa-config.js
module.exports = {
projectConfig: {
// ...
database_url: DATABASE_URL,
database_type: "postgres",
},
plugins,
}
Report Incorrect CodeCopy to Clipboard

Where DATABASE_URLCopy to Clipboard is the connection string to your PostgreSQL database. You can check out how to format it in PostgreSQL’s documentation.

Make sure to also remove the following lines that are used to configure an SQLite database:

medusa-config.js
database_type: "sqlite",
database_database: "./medusa-db.sql",
Report Incorrect CodeCopy to Clipboard

Then, migrate the database schema to the new PostgreSQL database:

medusa migrations run
Report Incorrect CodeCopy to Clipboard

If you want to add demo data into your backend, you should also seed the database using the following command:

yarn run seed
Report Incorrect CodeCopy to Clipboard

See Also