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

undefined method `[]=' for nil:NilClass due to missing client_id #881

Closed
muhammadn opened this issue May 4, 2017 · 2 comments
Closed

undefined method `[]=' for nil:NilClass due to missing client_id #881

muhammadn opened this issue May 4, 2017 · 2 comments

Comments

@muhammadn
Copy link

muhammadn commented May 4, 2017

I have this error when i am doing batch request:

undefined method `[]=' for nil:NilClass
…h-0.1.40/app/models/devise_token_auth/concerns/
user.rb: 218:in `extend_batch_buffer'

The offending code is in user.rb line 218

  def extend_batch_buffer(token, client_id)
    if self.tokens[client_id] != nil
      self.tokens[client_id]['updated_at'] = Time.now
    end

    return build_auth_header(token, client_id)
  end

Problem is, sometimes the tokens do not have the matching client_id which is from the request, and fails with undefined method []=' for nil:NilClass`

I will submit a PR which is a simple fix. See resolve #882

@MaicolBen
Copy link
Collaborator

@muhammadn Why did you close the PR?

@zachfeldman
Copy link
Contributor

We have a PR open to fix batching issues...hopefully it will be merged soon. Closing this for now.

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

No branches or pull requests

3 participants