Skip to content

Regexes cannot be stored in configuration in Erlang/OTP 28 #14648

@walkr

Description

@walkr

Elixir and Erlang/OTP versions

  • Erlang/OTP 28 [erts-16.0.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
  • Elixir 1.18.4 (compiled with Erlang/OTP 27)
  • phx_new-1.8.0-rc.3

Operating system

macOS 13.7.6 – 22.6.0 Darwin Kernel Version 22.6.0

Current behavior

About

The task mix release fails to generate the release in dev environment for a newly created Phoenix app.

Summary

  • mix release (× fails)
  • MIX_ENV=prod mix release (✓ ok)

Details

  • Setup Phoenix App
mix phx.new my_app --no-install
cd my_app
mix deps.get
  • Mix release task (dev)
mix release
Generated my_app app
* assembling my_app-0.1.0 on MIX_ENV=dev
* using config/runtime.exs to configure the release at runtime
** (Mix) Could not read configuration file. It has invalid configuration terms such as functions, references, and pids. Please make sure your configuration is made of numbers, atoms, strings, maps, tuples and lists. The following entries are wrong:

Application: :my_app
Key: MyAppWeb.Endpoint
Value: [url: [host: "localhost"], adapter: Bandit.PhoenixAdapter, render_errors: [formats: [html: MyAppWeb.ErrorHTML, json: MyAppWeb.ErrorJSON], layout: false], pubsub_server: MyApp.PubSub, live_view: [signing_salt: "ozNLRlPQ"], http: [ip: {127, 0, 0, 1}, port: 4000], check_origin: false, code_reloader: true, debug_errors: true, secret_key_base: "Deg4GS1Lxj/vIo94vcrLgpyOuQn2s8RKh1AYeyeq93l6SLJJzxBQf0HMhws/pXFH", watchers: [esbuild: {Esbuild, :install_and_run, [:my_app, ["--sourcemap=inline", "--watch"]]}, tailwind: {Tailwind, :install_and_run, [:my_app, ["--watch"]]}], live_reload: [web_console_logger: true, patterns: [~r/priv\/static\/(?!uploads\/).*(js|css|png|jpeg|jpg|gif|svg)$/, ~r/priv\/gettext\/.*(po)$/, ~r/lib\/my_app_web\/(?:controllers|live|components|router)\/?.*\.(ex|heex)$/]]]
  • Mix release task (prod)
MIX_ENV=prod mix release
Generated my_app app
* assembling my_app-0.1.0 on MIX_ENV=prod
* using config/runtime.exs to configure the release at runtime
* skipping elixir.bat for windows (bin/elixir.bat not found in the Elixir installation)
* skipping iex.bat for windows (bin/iex.bat not found in the Elixir installation)

Release created at _build/prod/rel/my_app

    # To start your system
    _build/prod/rel/my_app/bin/my_app start

Once the release is running:

    # To connect to it remotely
    _build/prod/rel/my_app/bin/my_app remote

    # To stop it gracefully (you may also send SIGINT/SIGTERM)
    _build/prod/rel/my_app/bin/my_app stop

To list all commands:

    _build/prod/rel/my_app/bin/my_app

case :file.consult(path) do
{:ok, _} ->
:ok
{:error, reason} ->
invalid =
for {app, kv} <- sys_config,
{key, value} <- kv,
not valid_config?(value),
do: """
Application: #{inspect(app)}
Key: #{inspect(key)}
Value: #{inspect(value)}
"""
message =
case invalid do
[] ->
"Could not read configuration file. Reason: #{inspect(reason)}"
_ ->
"Could not read configuration file. It has invalid configuration terms " <>
"such as functions, references, and pids. Please make sure your configuration " <>
"is made of numbers, atoms, strings, maps, tuples and lists. The following entries " <>
"are wrong:\n#{Enum.join(invalid)}"
end
{:error, message}
end

Additional Notes

  • Copying the above referenced configuration item into the config/config.exs of a simple elixir app (mix new my_app) will not crash the release process.

Expected behavior

The task mix release should succeed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions