skip to Main Content

I have my RoR app deployed in Heroku, with Devise authentication. Everything was working OK, but 2 days ago, I was informed that a rutinary Postgresql maintenance would be performed.

After that, my Users can’t log in into the App.

The App is working properly, since every part that has an exception of the user validation is shown as it should. I’ve checked the DB in Postgresql, and it is connected, ever since I did and exercise of creating a new user, and worked fine as I checked in the console.

But the Heroku Logs is showing an error that I don’t understand, and Heroku’s official answer was that the maintenance is not the problem, because they merely change the server of the DB, but nothing else, and that I should check for the solution here.

I’ve been reading other SO’s posts, and they suggest that the ENV var may have change, but I checked in the CLI and Dashboard and they coincide.

I don’t understand the error or how could I solve it. Please help.

I’ve gathered that the problem starts here "2023-03-01T17:52:29.666252+00:00 app[web.1]: [3dc02649-ca11-474b-bcb7-d08223602e58] NoMethodError (undefined method `empty?’ for #<User id: ALL THE USER INFORMATION CORRECT):".

I don’t know that undefined method ’empty?’ is referring to, since I haven’t touched anything related to Devise or the User DB in months.

Only have reached to Heroku’s support, but they say that is out of their scope.

I’ve checked the DB configuration for the User and the Devise validation, and nothing has been changed.

The Heroku Error logs (as jpg)
enter image description here
enter image description here

enter image description here

enter image description here

EDIT

I entered the Rails console through Heroku again, and I saw that a new user was created, and in the category column it gives something it should, as you can see the schema it should be category: "Estándar", but it gives "EstxC3xA1ndar". I’m posting both screenshots

enter image description here

enter image description here

EDIT LOGS as text

2023-03-01T21:44:34.378516+00:00 heroku[router]: at=info method=POST path="/users/sign_in" host=app.orbochile.com request_id=ef17f39d-6b6c-4d7b-8d8e-9d278b175157 fwd="138.84.33.192" dyno=web.1 connect=0ms service=282ms status=500 bytes=1861 protocol=https
2023-03-01T21:44:34.365860+00:00 app[web.1]: I, [2023-03-01T21:44:34.365800 #2] INFO — : [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] Completed 201 Created in 267ms (Views: 0.1ms | ActiveRecord: 6.0ms | Allocations: 2879)
2023-03-01T21:44:34.377567+00:00 app[web.1]: F, [2023-03-01T21:44:34.377503 #2] FATAL — : [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] 2023-03-01T21:44:34.377569+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] NoMethodError (undefined method empty?' for #<User id: 1, email: "[email protected]", name: "Ignacio", nick_name: "aiem2", phone: "56981855165", city: "Panquehue", state: "Valparaíso", dob: "1986-01-16", gender: "Masculino", admin: true, created_at: "2022-06-07 12:43:16.877117000 -0400", updated_at: "2023-03-01 18:44:34.357227000 -0300", category: "Colaborador", age: 37, ages: "35 a 44", last_name: "Espinosa", superadmin: true, tester: false, type_user: "Superadministrador">): 2023-03-01T21:44:34.377570+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] 2023-03-01T21:44:34.377572+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] activemodel (7.0.3.1) lib/active_model/attribute_methods.rb:458:in method_missing’
2023-03-01T21:44:34.377573+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] rack (2.2.6.2) lib/rack/etag.rb:71:in block in digest_body' 2023-03-01T21:44:34.377573+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] actionpack (7.0.3.1) lib/action_dispatch/http/response.rb:146:in each’
2023-03-01T21:44:34.377574+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] actionpack (7.0.3.1) lib/action_dispatch/http/response.rb:146:in each_chunk' 2023-03-01T21:44:34.377574+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] actionpack (7.0.3.1) lib/action_dispatch/http/response.rb:128:in each’
2023-03-01T21:44:34.377574+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] actionpack (7.0.3.1) lib/action_dispatch/http/response.rb:76:in each' 2023-03-01T21:44:34.377575+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] actionpack (7.0.3.1) lib/action_dispatch/http/response.rb:481:in each’
2023-03-01T21:44:34.377575+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] rack (2.2.6.2) lib/rack/body_proxy.rb:41:in method_missing' 2023-03-01T21:44:34.377576+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] rack (2.2.6.2) lib/rack/etag.rb:69:in digest_body’
2023-03-01T21:44:34.377576+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] rack (2.2.6.2) lib/rack/etag.rb:33:in call' 2023-03-01T21:44:34.377576+00:00 app[web.1]: [ef17f39d-6b6c-4d7b-8d8e-9d278b175157] rack (2.2.6.2) lib/rack/conditional_get.rb:40:in call’

EDIT

This may sound a crazy idea, but I created an empty? method in my User Model, and pushed it to Heroku.

Still not working, but now the error message of MissingMethod empty? didn’t appear, but a new error message:

"2023-03-01T22:24:56.539181+00:00 heroku[router]: at=info method=POST path="/users/sign_in" host=app.orbochile.com request_id=574ab971-6fde-468d-9514-7c441c1fdd2b fwd="138.84.33.192" dyno=web.1 connect=0ms service=264ms status=500 bytes=38 protocol=https
2023-03-01T22:24:56.528275+00:00 app[web.1]: I, [2023-03-01T22:24:56.528215 #2] INFO — : [574ab971-6fde-468d-9514-7c441c1fdd2b] Completed 201 Created in 252ms (Views: 0.2ms | ActiveRecord: 3.8ms | Allocations: 2846)
2023-03-01T22:24:56.538037+00:00 app[web.1]: 2023-03-01 22:24:56 +0000 Read: #<NoMethodError: undefined method `bytesize’ for #<User id: 1, email: "[email protected]", name: "Ignacio", nick_name: "aiem2", phone: "56981855165", city: "Panquehue", state: "Valparaíso", dob: "1986-01-16", gender: "Masculino", admin: true, created_at: "2022-06-07 12:43:16.877117000 -0400", updated_at: "2023-03-01 19:24:56.520624000 -0300", category: "Colaborador", age: 37, ages: "35 a 44", last_name: "Espinosa", superadmin: true, tester: false, type_user: "Superadministrador">>"

2

Answers


  1. Chosen as BEST ANSWER

    ANSWER

    The problem was not Heroku, the maintenance or anything like that.

    The method missing empty? is because of the latest update of Devise Gem.

    4.9.0 - February 17, 2023 (92 ko)

    4.8.1 - December 16, 2021 (89 ko)

    Last time I committed and pushed something was Feb 6th and I didn't specify in my gem file the version of Devise. Thus, with the new commit and push I did 2 days ago, Heroku correctly updated the version of Devise in my bundle, and generated this problem.

    Solved it with specifying the Devise version to the one I was using without bugs, and now I'll see what I have to do to upgrade the Devise version.

    Thank you all for the comments and solutions proposed, this was my first SO post.


  2. The 1st error I can see in the posted logs is:

    NoMethodError (undefined method `empty?' for #<User: ...
    

    So that’s clearly an error in your code, as you are calling the method empty? on a User instance and that method is undefined):

    > User.last.empty?
    => NoMethodError (undefined method `empty?' for #<User:0x0000000123a1a5d0>)
    

    Maybe that’s something that you added in the past, but never deployed it since now… or perhaps a "bad" deploy that didn’t restarted your workers?

    I’ll start by checking all .empty? calls in the code.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search