Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got error ArgumentError: wrong number of arguments (given 2, expected 1) #1865

Closed
dim0627 opened this issue Aug 12, 2022 · 5 comments
Closed
Assignees
Labels

Comments

@dim0627
Copy link

dim0627 commented Aug 12, 2022

Hello team!
I have problem and need help.

I just update sentry-ruby from 4.3.1 to 5.4.1, I got this error with rspec.
Anyone have solution? Let me know please 🙏

  1) Xxxx GET /Xxxx/:id Got status 500
     Failure/Error:
       expect do
         get_xxxx
       end.to raise_error(NoMethodError)
     
       expected NoMethodError, got #<ArgumentError: wrong number of arguments (given 2, expected 1)> with backtrace:
@st0012
Copy link
Collaborator

st0012 commented Aug 12, 2022

@dim0627 Can you provide the backtrace and the full list of Sentry related gems? That'll help us locate the cause

@Jaco-Pretorius
Copy link

I'm getting the exact same error, also within an rspec request spec.

expect { get '/register.asp' }.to raise_error(ActionController::RoutingError)

used to work, now I get

ArgumentError: wrong number of arguments (given 2, expected 1)
from /Users/my-username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sentry-rails-4.8.3/lib/sentry/rails/capture_exceptions.rb:23:in `capture_exception'
Caused by ActionController::RoutingError: No route matches [GET] "/register.asp"
from /Users/my-username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'

@st0012
Copy link
Collaborator

st0012 commented Aug 12, 2022

@Jaco-Pretorius If you also got the error after you upgraded sentry-ruby to the latest version, it's because sentry-rails is not updated along with it. Once you also upgrade sentry-rails, it should solve the problem.
Unfortunately we don't have a way to enforce that as explained in: #1859 (comment)

@Jaco-Pretorius
Copy link

@st0012 Ah, that did indeed fix it. I do wish there was a way to enforce that, or to make it more obvious. I ran into this error as part of a PR that dependabot opened.

At a high level, why can't sentry-rails just have sentry-ruby as a dependency? Then you would only need to add sentry-rails to your Gemfile and both would be updated at the same time?

@dim0627
Copy link
Author

dim0627 commented Aug 12, 2022

@st0012
Thank you for reply!
And I'm sorry, I solved this problem after the update sentry-rails, sentry-sidekiq 🙏

@dim0627 dim0627 closed this as completed Aug 12, 2022
ollietreend added a commit to alphagov/whitehall that referenced this issue Aug 15, 2022
This commit bumps all three Sentry gems used by this project to version 5.4.1.

An internal API change was made in the Sentry gems which means 5.3.x gems aren't compatible with 5.4.x gems.

If all three gems aren't updated at the same time, we end up with test failures containing error messages like this:

```
exception expected, not
Class: <ArgumentError>
Message: <"wrong number of arguments (given 1, expected 2)">
```

For further details, see getsentry/sentry-ruby#1859 and getsentry/sentry-ruby#1865.
BeckaL added a commit to alphagov/link-checker-api that referenced this issue Aug 16, 2022
This commit bumps all three Sentry gems used by this project to version 5.4.1.

An internal API change was made in the Sentry gems which means 5.3.x gems aren't compatible with 5.4.x gems.

If all three gems aren't updated at the same time, we end up with test failures containing error messages like this:

```
exception expected, not
Class: <ArgumentError>
Message: <"wrong number of arguments (given 1, expected 2)">
```

For further details, see getsentry/sentry-ruby#1859 and getsentry/sentry-ruby#1865.
BeckaL added a commit to alphagov/transition that referenced this issue Aug 16, 2022
This commit bumps all three Sentry gems used by this project to version 5.4.1.

An internal API change was made in the Sentry gems which means 5.3.x gems aren't compatible with 5.4.x gems.

If all three gems aren't updated at the same time, we end up with test failures containing error messages like this:

```
exception expected, not
Class: <ArgumentError>
Message: <"wrong number of arguments (given 1, expected 2)">
```

For further details, see getsentry/sentry-ruby#1859 and getsentry/sentry-ruby#1865.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants