Skip to content

Permission restrictions of dotenv files up the tree prevent build, even if DATABASE_URL present in env or local dotenv #4348

Description

@iceman

I have found these related issues/pull requests

error: error reading dotenv file

Description

This problem seems to be introduced in 0.90. Even if sqlx has all the env variables it needs to complete the build, a restricted permission dotenv two directories up blocks compilation.

Reproduction steps

.env file two directories up the tree from rust project directory with restricted read permissions for the user

SQLx version

0.90

Enabled SQLx features

"runtime-tokio", "tls-rustls-ring-native-roots", "macros", "postgres", "uuid", "chrono", "migrate", "bigdecimal"

Database server and version

postgres 18.2

Operating system

Ubuntu 26.04

Rust version

rustc 1.97.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions