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

Request is nil in middleware #228

Open
sdhull opened this issue Feb 29, 2024 · 1 comment
Open

Request is nil in middleware #228

sdhull opened this issue Feb 29, 2024 · 1 comment

Comments

@sdhull
Copy link

sdhull commented Feb 29, 2024

Tell us about your environment

Ruby version: 2.7.7p221
anycable gem version: 1.3.0
anycable-rails gem version: 1.3.7
grpc gem version: 1.47.0

What did you do?

That's what's weird—we haven't made any recent changes.

What did you expect to happen?

No exceptions 😄

What actually happened?

NoMethodError: undefined method `env' for nil:NilClass Did you mean? end
      def call(_method, request, meta)
        return yield unless meta["sid"]
        request.env.sid = meta["sid"]

        yield
  env_sid.rb  9  call(...)
[GEM_ROOT]/gems/anycable-core-1.3.0/lib/anycable/middlewares/env_sid.rb:9:in `call'

Unfortunately I do not have a reproduction for you. This only started yesterday and we've only had 146 of these errors sporadically happen. At peak times we have ~2.7k connected clients. My assumption is that in these cases, the websocket connection will fail and the js client will attempt reconnect, so at least customer impact should be minimal or nonexistent. But I am confused. Why did this start now? We haven't introduced new channels or new websocket functionality or any infrastructure changes (at least not as far as I'm aware of).

Have you seen anything like this before? Should I be more concerned?

@palkan
Copy link
Member

palkan commented Mar 5, 2024

Thanks for the report!

No, I haven't seen this before. Can you show more log lines or maybe you know which RPC call was that? (Connect, Command or Disconnect).

And do you use gRPC server or serve RPC over HTTP?

Also, what's the version of anycable-go?

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

No branches or pull requests

2 participants