Problem pushing new translations?
cannikin opened this issue · 10 comments
I'm getting an error when trying to push translations:
$ bin/localeapp push config/locales/en-US.yml
Localeapp Push
Pushing file en-US.yml:
error: closed stream
I haven't tried manually pushing for months so I don't know if this just a temporary thing or has been down for a while...
Hello, maybe the connection was open since more than 30 seconds? We have constraints due to our hosting provider we can't easily change, more detail is available in this issue: #174.
If you get this error with a short-lived (less than 30 seconds) connection, then it's a different issue, and I'd be interested to know if you have anything special in your YAML file?
It took about 7 seconds between the "Pushing file" message and the "error: closed stream" message.
What do you mean by "special"? :) Nothing other than text...the file that's there now was updated by localeapp itself so I assume everything is valid. I was able to parse the file manually without error:
YAML.parse_file(Rails.root.join('config','locales','en-US.yml'))
#<Psych::Nodes::Document:0x007fa66880a938 @children=[#<Psych::Nodes::Mapping:0x007fa66880a8e8...
Here's the current content of en-US.yml
:
https://gist.github.com/cannikin/81d2af17e81c338a39dac9122b5cf8d6
I tried doing a localeapp pull
and get another error:
$ localeapp pull
Localeapp Pull
Fetching translations:
Failed!
That took about 15 seconds between "Fetching" and "Failed!".
My app doesn't seem have any problem polling and sending while in development mode.
@cannikin I remember getting this error and the problem ended up being the API key I had set in my config file was incorrect. Try double checking that.
What do you mean by "special"? :) Nothing other than text...the file that's there now was updated by localeapp itself so I assume everything is valid.
I had nothing particular in mind, but thing like aliases,
unconventional values (not integer or text) etc… might not help. I
didn't know yet if you could disclose it or not. With your real file
it's perfect I have everything I need :-)
I did a few tests with your data, but was not able to reproduce (yet)
with a correct API key.
With an incorrect API key, on push, I confirm I observe the same
behavior @deivid-rodriguez described. On pull, I get this:
$ bundle exec localeapp pull
Localeapp Pull
Fetching translations:
error: 406 Not Acceptable
zsh: exit 1 bundle exec localeapp pull
This is definitely something we need to fix.
But in case this is not your problem:
- Which version of the gem are you using?
- Did you set any particular networking options? (proxying, timeouts,
TLS/SSL…) - Is the program running when you send INFO signal (if you can) during
the 7 secs or 15 secs delay, or waiting on a syscall?
AHHH I was able to get push
and pull
to run by setting the API key with the -k
flag manually:
$ localeapp -k abcdefgh12345 push config/locales/en-US.yml
Localeapp Push
Pushing file en-US.yml:
Success!
config/locales/en-US.yml queued for processing.
In my config/initializers/localeapp.rb
I've got the API key coming from an ENV
variable, which is set via the dotenv
gem. I thought maybe I just needed to load dotenv
in the localeapp
bin file, but then I get a totally different error:
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup"
require 'dotenv'
Dotenv.load
load Gem.bin_path("localeapp", "localeapp")
$ bin/localeapp push config/initializers/localeapp.rb
Localeapp Push
Pushing file localeapp.rb:
error: 415 Unsupported Media Type
Then I figured I should double-check and just hard-code the API key into config/initializers/localeapp.rb
but it gives me the same 415
error!
require 'localeapp/rails'
Localeapp.configure do |config|
config.api_key = 'abdefgh12345'
end
So far the only way I can get a push to work successfully is to include the API key on the command line. Am I crazy?
You're not using your real API key here, right? Just saying because you've written 2 different values here: abcdefgh12345
and abdefgh12345
.
haha Yeah that's just a placeholder for the issue, I'm using the real one I promise. :)
Also, are you trying to push a ruby file to localeapp??
HAHA Damn it, too many files.
Yes, the 415
was because I was pushing the wrong file, sorry!
Okay, once I actually pushed the correct locale file I was able to get it to push by adding Dotenv.load
to the bin file so that all the environment variables were present.
Okay, in conclusion: I couldn't push because the API key was in an ENV
variable and the ENV
variables that are normally loaded by dotenv
weren't present because dotenv
wasn't included. All better!
Good to hear, glad you fixed it!