DioxusLabs / DioxusLabs/dioxus

Env variables not preserved after hotpatching

Open
#5,327 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

Environment variables are not preserved after hotpatching when running `dx serve --hotpatch`.

**Steps To Reproduce**

Steps to reproduce the behavior:

- Run `dx serve --hotpatch` (e.g., `dx serve --hotpatch --web --port 1202`), with env variables configured via `.env` file or injected via CLI (e.g., `export DATABASE_URL=postgresql://user:pass@ip:port/db_name && dx serve --hotpatch --web --port 1202`).
- On initial startup, everything loads correctly and Dioxus application behaves as expected.
- Make changes to Rust library/binary code used in Dioxus application.
- Hotpatch succeeds, but fails to reload env variables. Will see logs corresponding to failure to load env variables as needed by application, e.g., `[server] DATABASE_URL must be set via .env file or environment variable`.

**Expected behavior**

Environment variables should be reloaded correctly when hotpatching, without needing to fully rebuild the application.

Note that this is not a problem if we run **without** hotpatching flag, i.e., if we fully rebuild each time we make non-reloadable changes.

**Environment:**

- Dioxus version: v0.7.3
- Rust version: v1.93.1
- OS info: macOS 26.2
- App platform: web, desktop (may happen with other platforms too, but only tested these)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.