Skip to content

Conversation

@kbrock
Copy link
Member

@kbrock kbrock commented Oct 29, 2025

Not sure why my system decided it was a good idea to run under ruby 3.4...
Ruby changed the way they report backtraces

- app/controllers/api/base_controller/logger.rb:61:in `Api::BaseController::Logger#api_get_method_name'
+ app/controllers/api/base_controller/logger.rb:61:in 'Api::BaseController::Logger#api_get_method_name'

The code was no longer able to determine the method name in recent ruby versions.
This meant that it would use the method (symbol) and Symbol#sub doesn't work.

So we did 2 things:

  • match backtraces for older rubies and newer versions.
  • Convert method to a String so String#sub will work.

Reproducer

(pretty much every request test fails along with every api request)

$ chruby 3.4.7
$ be rspec spec/requests/logging_spec.rb

Before

Causes:
NoMethodError (undefined method 'sub' for an instance of Symbol)

app/controllers/api/base_controller/logger.rb:61:in 'Api::BaseController::Logger#api_get_method_name'

After

other test failures (since string concatenation changed across ruby versions)

But at least the app seems to work.

@kbrock kbrock requested a review from bdunne as a code owner October 29, 2025 04:56
@kbrock kbrock added the bug label Oct 29, 2025
@Fryguy
Copy link
Member

Fryguy commented Oct 29, 2025

Can you add a spec demonstrating the failure. Also PR title.

@kbrock kbrock changed the title Logger Remove unpermitted parameters and handle override gem Oct 29, 2025
Ruby changed the way they report backtraces

```diff
- app/controllers/api/base_controller/logger.rb:61:in `Api::BaseController::Logger#api_get_method_name'
+ app/controllers/api/base_controller/logger.rb:61:in 'Api::BaseController::Logger#api_get_method_name'
```

The code was no longer able to determine the method name in recent ruby versions.
This meant that it would use the method (symbol) and `Symbol#sub` doesn't work.

So we did 2 things:

- match backtraces for older rubies and newer versions.
- Convert `method` to a String so `String#sub` will work.

Reproducer
==========

```
curl -k -u admin:smartvm --basic http://localhost:3000/api/service_catalogs
```

Before
======

```
Causes:
NoMethodError (undefined method 'sub' for an instance of Symbol)

app/controllers/api/base_controller/logger.rb:61:in 'Api::BaseController::Logger#api_get_method_name'
```

fixup! fix logger issues
@kbrock kbrock changed the title Remove unpermitted parameters and handle override gem Remove unpermitted parameters and handle newer ruby versions Oct 29, 2025
@kbrock kbrock changed the title Remove unpermitted parameters and handle newer ruby versions Remove unpermitted parameters and support newer ruby versions Oct 29, 2025
@kbrock kbrock changed the title Remove unpermitted parameters and support newer ruby versions Support newer ruby versions Oct 29, 2025
@kbrock
Copy link
Member Author

kbrock commented Oct 29, 2025

update:

@Fryguy Fryguy closed this Oct 29, 2025
@Fryguy Fryguy reopened this Oct 29, 2025
@kbrock kbrock closed this Oct 31, 2025
@kbrock kbrock deleted the logger branch October 31, 2025 16:21
@kbrock kbrock restored the logger branch October 31, 2025 16:22
@kbrock
Copy link
Member Author

kbrock commented Oct 31, 2025

ugh. please see #1302 - identical but I pushed a branch incorrectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants