theseus-rs / postgresql-embedded

Embed PostgreSQL database
Apache License 2.0
43 stars 5 forks source link

Connection Error: error returned from database: invalid value for parameter "TimeZone": "UTC" #44

Closed ShelbyJenkins closed 3 months ago

ShelbyJenkins commented 4 months ago

Running in an devcontainer as user 'vscode'.

This error comes when I try to connect with sea-orm like Database::connect(pg.settings().url(database_name)).await

Installing tzdata and setting the timezone to UTC seems to have resolved it. Perhaps this is something that can be resolved in the crate itself?

brianheineman commented 4 months ago

Were you attempting to use this https://github.com/theseus-rs/postgresql-embedded/tree/main/.devcontainer ?

If so, could you provide the steps to reproduce, and/or a PR with the changes you made that worked for you?

ShelbyJenkins commented 4 months ago

Using my own container. This was the fix:

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        tzdata 

# Set the timezone environment variable
ENV TZ=UTC

# Configure timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
brianheineman commented 3 months ago

Thanks for the follow up @ShelbyJenkins; glad you got everything working.