celenity/Phoenix
8
198
Fork
You've already forked Phoenix
19

[BUG] Nix module's empty SSLKEYLOGFILE environment variable is breaking other software #300

Closed
opened 2026年05月29日 00:39:17 +02:00 by amartin · 2 comments

Confirmation Checklist

What web browser(s) are you using with Phoenix?

Firefox Developer Edition

Other

No response

What operating system(s) are you experiencing this issue on?

NixOS

Other

No response

What version of Firefox/Gecko and Phoenix are you using?

152.0b1 (Phoenix: 2026年05月21日.2)

If you remember, what version of Firefox/Gecko and Phoenix did you first notice the issue on?

No response

Does the issue occur on a new browser profile?

  • Yes
  • No

Please share your browser's distribution ID.

Not relevant here

Please share your browser's update channel.

Not relevant here

Please share a list of your currently installed browser add-ons/extensions, as well as the versions you have installed.

Not relevant here

Please explain the issue you are experiencing.

When the Phoenix NixOS module sets the environment variable SSLKEYLOGFILE to an empty string, it causes runtime errors in Elixir and Erlang applications that use HTTP client libraries like Finch (which is the default in the Elixir Phoenix framework) or Req. These libraries try to open the file path in SSLKEYLOGFILE if it is set, even if it is empty. This results in a crash with a "could not open "": no such file or directory" error. The problem is not specific to Elixir but affects any software that expects SSLKEYLOGFILE to be either unset or a valid file path.

I've been debugging and quite frustrated for a long time today because my codebase was working the last time I touched that project 3 months ago (before installing Phoenix as a NixOS module), and suddenly it was throwing this cryptic error that I couldn't even find answers to online. I'm wondering if it's really necessary to set that environment variable, since if it causes problems in Elixir, I suppose it causes problems elsewhere, especially since it's empty?

Please provide detailed steps to reproduce the issue.

  1. Enable the Phoenix NixOS module or otherwise set SSLKEYLOGFILE to an empty string in your environment
  2. Open a shell and run any Elixir or Erlang application that uses HTTP over SSL, for example:
$ iex -S mix
{:ok, _pid} = Finch.start_link(name: TestFinch)
  1. The application will crash with a file error when trying to open SSLKEYLOGFILE as a file

I don't really have another example to reproduce right now, sorry if this makes things more complicated. Please also let me know if you'd prefer I open an issue in the Finch repository; I'm not sure which would be more appropriate. Thanks in advance.

### Confirmation Checklist - [x] I confirm that this issue occurs on the **latest release** of Phoenix. You can check what the latest version is on [the `Releases` page](https://codeberg.org/celenity/Phoenix/releases). - [x] I confirm that this issue has **NOT** already been reported on [the Codeberg issue tracker](https://codeberg.org/celenity/Phoenix/issues), [the GitLab issue tracker](https://gitlab.com/celenityy/Phoenix/-/issues), **and/or** [the GitHub issue tracker](https://github.com/celenityy/Phoenix/issues). ### What web browser(s) are you using with Phoenix? Firefox Developer Edition ### Other _No response_ ### What operating system(s) are you experiencing this issue on? NixOS ### Other _No response_ ### What version of Firefox/Gecko and Phoenix are you using? 152.0b1 (Phoenix: 2026年05月21日.2) ### If you remember, what version of Firefox/Gecko and Phoenix did you first notice the issue on? _No response_ ### Does the issue occur on a new browser profile? - [ ] Yes - [x] No ### Please share your browser's distribution ID. Not relevant here ### Please share your browser's update channel. Not relevant here ### Please share a list of your currently installed browser add-ons/extensions, as well as the versions you have installed. Not relevant here ### Please explain the issue you are experiencing. When the Phoenix NixOS module sets the environment variable `SSLKEYLOGFILE` to an empty string, it causes runtime errors in Elixir and Erlang applications that use HTTP client libraries like Finch (which is the default in the Elixir Phoenix framework) or Req. These libraries try to open the file path in `SSLKEYLOGFILE` if it is set, even if it is empty. This results in a crash with a "could not open "": no such file or directory" error. The problem is not specific to Elixir but affects any software that expects `SSLKEYLOGFILE` to be either unset or a valid file path. I've been debugging and quite frustrated for a long time today because my codebase was working the last time I touched that project 3 months ago (before installing Phoenix as a NixOS module), and suddenly it was throwing this cryptic error that I couldn't even find answers to online. I'm wondering if it's really necessary to set that environment variable, since if it causes problems in Elixir, I suppose it causes problems elsewhere, especially since it's empty? ### Please provide detailed steps to reproduce the issue. 1. Enable the Phoenix NixOS module or otherwise set `SSLKEYLOGFILE` to an empty string in your environment 2. Open a shell and run any Elixir or Erlang application that uses HTTP over SSL, for example: ```bash $ iex -S mix {:ok, _pid} = Finch.start_link(name: TestFinch) ``` 3. The application will crash with a file error when trying to open `SSLKEYLOGFILE` as a file --- I don't really have another example to reproduce right now, sorry if this makes things more complicated. Please also let me know if you'd prefer I open an issue in the Finch repository; I'm not sure which would be more appropriate. Thanks in advance.

@amartin Thank you!

I've now made it so the environment variables are properly unset, instead of being set to an empty string. For Nix, based on the docs, I set SSLKEYLOGFILE (and the other variables we want to unset) to null - which should work to avoid issues like this.

(On a side note, I really wish we could set environment variables for Firefox only - instead of setting them on the system level, but unfortunately I don't know of a reliable way that we can do that ATM).

Please also let me know if you'd prefer I open an issue in the Finch repository; I'm not sure which would be more appropriate.

IMO this is still worth reporting to Finch as well - they should probably add a check to ensure SSLKEYLOGFILE is set to a valid file path before attempting to write to it.

@amartin Thank you! I've now made it so the environment variables are properly unset, instead of being set to an empty string. For Nix, based on [the docs](https://search.nixos.org/options?channel=unstable&query=environment.variables#show=option%253Aenvironment.variables), I set `SSLKEYLOGFILE` *(and the other variables we want to unset)* to `null` - which should work to avoid issues like this. *(On a side note, I really wish we could set environment variables for Firefox only - instead of setting them on the system level, but unfortunately I don't know of a reliable way that we can do that ATM)*. > Please also let me know if you'd prefer I open an issue in the Finch repository; I'm not sure which would be more appropriate. IMO this is still worth reporting to Finch as well - they should probably add a check to ensure `SSLKEYLOGFILE` is set to a valid file path before attempting to write to it.
Author
Copy link

Thank you so much for the quick response and the fix!

I'll also report the issue to Finch. Cheers! :)

Thank you so much for the quick response and the fix! I'll also report the issue to Finch. Cheers! :)
Sign in to join this conversation.
No Branch/Tag specified
dev
pages
2026年07月08日.1
2026年06月10日.1
2026年05月21日.2
2026年05月21日.1
2026年04月27日.1
2026年03月31日.1
2026年03月30日.1
2026年02月23日.1
2026年02月16日.1
2026年01月21日.1
2025年12月23日.1
2025年11月27日.1
2025年11月07日.1
2025年10月26日.1
2025年10月12日.1
2025年10月03日.1
2025年09月07日.1
2025年08月06日.1
2025年07月30日.1
2025年07月11日.1
2025年06月24日.1
2025年06月12日.1
2025年06月10日.1
2025年06月06日.1
2025年06月02日.2
2025年06月02日.1
2025年05月11日.1
2025年04月27日.1
2025年04月15日.1
2025年04月11日.1
2025年04月02日.1
2025年03月25日.1
2025年03月20日.1
2025年03月12日.1
2025年03月05日.1
2025年02月28日.1
2025年02月21日.1
2024年02月18日.1
2025年02月14日.1
2025年02月13日.1
2025年02月01日.1
2025年01月30日.1
2025年01月27日.1
2025年01月24日.1
2025年01月22日.2
2025年01月22日.1
2025年01月20日.2
2025年01月20日.1
2025年01月19日.1
2025年01月14日.1
2025年01月13日.1
2025年01月12日.2
2025年01月12日.1
2025年01月06日.1
05January2025v1
20240103.2
20250103.1
20241229-1
20241225-1
20241216-1
20241211-1
20241204-1
20241203-1
31November2024v1
20241103-1
20240924-1
20240914-1
20240907-1
20240902-1
20240831-1
20240825-1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
celenity/Phoenix#300
Reference in a new issue
celenity/Phoenix
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?