bkeepers / dotenv

A Ruby gem to load environment variables from `.env`.
MIT License
6.61k stars 505 forks source link

Dotenv's tagged method conflicts with SemanticLogger's #497

Closed kolobock closed 8 months ago

kolobock commented 8 months ago

Steps to reproduce

SemanticLogger is used as default Rails logger in the application. Once we call dotenv/load we got error. This started to be reproduced at v3.0.3 (https://github.com/bkeepers/dotenv/pull/489)

Expected behavior

Dotenv should load ENVs without any issue.

Actual behavior

LocalJumpError:
  no block given (yield)
# /ruby/3.2.0/gems/semantic_logger-4.15.0/lib/semantic_logger/base.rb:190:in `block in tagged'
# /ruby/3.2.0/gems/semantic_logger-4.15.0/lib/semantic_logger/semantic_logger.rb:319:in `fast_tag'
# /ruby/3.2.0/gems/semantic_logger-4.15.0/lib/semantic_logger/base.rb:197:in `tagged'
# /ruby/3.2.0/gems/dotenv-3.0.3/lib/dotenv/rails.rb:93:in `block in <class:Rails>'
# /ruby/3.2.0/gems/railties-7.0.8.1/lib/rails/initializable.rb:32:in `instance_exec'
# /ruby/3.2.0/gems/railties-7.0.8.1/lib/rails/initializable.rb:32:in `run'
# /ruby/3.2.0/gems/railties-7.0.8.1/lib/rails/initializable.rb:61:in `block in run_initializers'
# /ruby/3.2.0/gems/railties-7.0.8.1/lib/rails/initializable.rb:60:in `run_initializers'
# /ruby/3.2.0/gems/railties-7.0.8.1/lib/rails/application.rb:372:in `initialize!'
# ./config/environment.rb:5:in `<top (required)>'
# ./spec/rails_helper.rb:7:in `<top (required)>'

System configuration

dotenv version: >= 3.0.3

Rails version: 7.0.8.1

Ruby version: 3.2.3

bkeepers commented 8 months ago

Duplicate of #493, fixed in 3.1.0