We've moved discussions to Discord

NoMethodError for class:ConnectedAccount [SOLVED]

Dan Weaver
The application encountered the following error: undefined method `unpack1' for nil:NilClass (NoMethodError)
/home/deploy/.rbenv/versions/2.6.3/lib/ruby/2.6.0/base64.rb:59:in `decode64'
/home/deploy/Klippr/releases/20190814030557/app/models/user/connected_account.rb:37:in `<class:ConnectedAccount>'

Trying to set up a simple Jumpstart Pro-based app on Hatchbox.io and seeing this error when accessing the site. Same app is running fine in dev.

Anyone else seen/solved this?

Dan Weaver
The line triggering the error is:
attr_encrypted :access_token, key: Base64.decode64(Rails.application.credentials.access_token_encryption_key)
so it seems to be related to missing credentials.

I'm new to the whole Rails credentials thing - my main Rails app is still 3.2.14 and using Figaro for keys, retro 😉 - so I created a production.yml.enc file to see if that fixed the issue. Redeployed but still getting the same error.
Dan Weaver
OK, doink! I hadn't added the RAILS_MASTER_KEY environment variable.

Told you I was new to these fancy credentials 😂
Bryce Telfer
Thanks for posting this Dan,  this helped me too!
Jason Eastwood
Brian Carpenter
helpful, thanks.
Chris Oliver
This will be removed in the Rails 7 update as we're moving everything to the built-in encryption. 💪
You’re not receiving notifications from this thread.