Why Can't Embeddable Find My Database Connection In My Environment?

If you’re seeing this error:

Embeddable Error: Could not find a database connection for data_source '[DATA SOURCE NAME]' in environment '[ENVIRONMENT NAME]'\"

The most likely culprit is that you are referencing that data source in one of your models, but it hasn’t been mapped in all of your environments. All data sources referenced in your models must exist in all of your environments. So for example, if you have a data source called postgres, and environments called staging and prod you would want to create two connections:

  1. postgres-staging
  2. postgrest-prod

Then when configuring your environments, you would map the postgres data source to postgres-staging in the staging environment, and map the postgres data source to postgrest-prod in the prod environment. This ensures that your models will compile properly when using either environment.