transifex/txgh

Txgh not working on Heroku

Closed this issue · 6 comments

I tried to setup a Txgh instance on Heroku using this guide: https://www.transifex.com/blog/2015/bridging-github-and-transifex-with-txgh/ but it doesn't seems to be working.

When github tries to call the webhook, it fails with a HTTP 500. Here's the log on the Heroku side.

As a side note, the "Add Environment Variables Using txgh_config.rb" part of the doc doesn't works anymore. It seems the rake task was removed by this commit: 7880492

I tried the other option using the Heroku dashboard but without no more luck...

@Guillaumito Based on the log, looks like you are missing github configurations.

If you need any more help please provide more information about the config file.

Thanks for catching Environment variable issue.

I didn't do any changes in the txgh.yml and I set the config in the Heroku dashboard as described in the documentation:
heroku

Hi,
The way configuration on heroku is intended to work is that it should use the Ruby ENV hash object set by default. So your configuration file becomes a template.
So if you are using the default yml here: https://github.com/transifex/txgh/blob/master/config/txgh.yml

You'll want to make sure the keys match with this template (you'll notice that the keys are different from your screenshot).

Also be aware of the environment string, I think heroku sets this to 'prod' by default when it runs your code. This also needs to match whatever you setup.

I'll definitely bring back the config_env gem, thanks for pointing this out. I didn't think anyone would use it!

I tried using variables names in Heroku matching those of the txgh.yml but it produced an error similar to the previous one. So, I ended up hardcoding the value in my txgh.yml file.

It's still not working but with a different error.

Yep, it looks like there is still an issue in your config if you notice this at the top of the trace:

2016-08-10T20:06:15.055625+00:00 app[web.1]: 2016-08-10 20:06:15 +0000: Rack app error: #<NoMethodError: undefined method `[]' for nil:NilClass>
2016-08-10T20:06:15.055650+00:00 app[web.1]: /app/lib/txgh/key_manager.rb:18:in `config_from_repo'

See here in the code: https://github.com/transifex/txgh/blob/master/lib/txgh/key_manager.rb#L18
This is where we are reading the config into the app specifically for 'push_source_to'.

Looking at your config file, here are a few things you can check:

  1. Check the capitalization of the Transifex project, this might be an issue as the correct project slug should be lowercase (you can check this when viewing the project url in the Transifex dashboard).
  2. I'm not sure that you need the 'heads' for your branch, I think Txgh will add this for you if you just leave it as 'master'.

I hope that helps!

Ok, looks like I've been a bit stupid here... My config have been working since I'm using a txgh.yml file, but I thought it wasn't because it fails with the github test payload. When doing a real push on the repository, it does works.

So... everything looks ok, except the outdated documentation and maybe telling users that the test on github doesn't works :)

Thanks for your help!