Marco MCNULTY
Joined
Activity
I had a weird issue where running the "rails credentials:edit --environment=development" command (from the integrated terminal in VSCode) would open up a new development.yml file instead of the existing one with the commented out aws credentials that is pre-populated by Rails.
This was resulting in me getting a 400 error from OmniAuth because Rails.application.credentials was returning nil.
I spent ages chasing my tail and looking into all kinds of other things before coming across:
https://github.com/rails/rails/issues/37427
It turns out that running the below command forced Rails to open the correct file to edit rather than create a new one and I was good to go!
EDITOR='code --wait' rails credentials:edit --environment=development
The fix to ensure that you won't have to do this again in future is to make sure that in any file where you may have specified VSCode to be your default editor e.g. your .zprofile etc. you need to make sure that you add the wait flag!
In my case, I had: export EDITOR="code" and this fixed it: export EDITOR="code -w".
You may want to apply this to your global .gitconfig file while you're at it:
[core]
editor = code --wait