Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honcho fails on Heroku because, USER variable is not set #33

Closed
dasty opened this issue Apr 1, 2013 · 3 comments
Closed

Honcho fails on Heroku because, USER variable is not set #33

dasty opened this issue Apr 1, 2013 · 3 comments

Comments

@dasty
Copy link

@dasty dasty commented Apr 1, 2013

Tested version: 0.4.0

Steps to reproduce: run Honcho on Heroku, for example by putting "web: honcho -f ProcfileHoncho start" into your Procfile and "honcho==0.4.0" into your requirements.txt.

Actual behaviour: following error message is printed into heroku log:

2013-04-01T17:31:29+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-01T17:31:48+00:00 heroku[web.1]: Starting process with command `honcho -f ProcfileHoncho start`
2013-04-01T17:31:49+00:00 app[web.1]:     load_entry_point('honcho==0.4.0', 'console_scripts', 'honcho')()
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/pkg_resources.py", line 337, in load_entry_point
2013-04-01T17:31:49+00:00 app[web.1]:     return get_distribution(dist).load_entry_point(group, name)
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/pkg_resources.py", line 2279, in load_entry_point
2013-04-01T17:31:49+00:00 app[web.1]:     return ep.load()
2013-04-01T17:31:49+00:00 app[web.1]: Traceback (most recent call last):
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/bin/honcho", line 9, in <module>
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/pkg_resources.py", line 1989, in load
2013-04-01T17:31:49+00:00 app[web.1]:     entry = __import__(self.module_name, globals(),globals(), ['__name__'])
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py", line 66, in <module>
2013-04-01T17:31:49+00:00 app[web.1]:     class Honcho(object):
2013-04-01T17:31:49+00:00 app[web.1]:     default=os.environ['USERNAME' if compat.ON_WINDOWS else 'USER'],
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py", line 205, in Honcho
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/UserDict.py", line 23, in __getitem__
2013-04-01T17:31:49+00:00 app[web.1]:     raise KeyError(key)
2013-04-01T17:31:49+00:00 app[web.1]: KeyError: 'USER'
2013-04-01T17:31:50+00:00 heroku[web.1]: Process exited with status 1
2013-04-01T17:31:50+00:00 heroku[web.1]: State changed from starting to crashed

Expected behaviour: tasks defined in ProcfileHoncho are started correctly

Temporary workaround: define USER variable on heroku:

heroku config:set USER=heroku
@nickstenning
Copy link
Owner

@nickstenning nickstenning commented Apr 2, 2013

Thanks for reporting this. It should be pretty easy to fix — I'll try and get to it soon. 

Out of interest, can I ask why you're using honcho on Heroku rather than using Heroku's native Procfile support?

On Mon, Apr 1, 2013 at 7:07 PM, Radek Dostál notifications@github.com
wrote:

Tested version: 0.4.0
Steps to reproduce: run Honcho on Heroku, for example by putting "web: honcho -f ProcfileHoncho start" into your Procfile and "honcho==0.4.0" into your requirements.
Actual behaviour: following error message is printed into heroku log:

2013-04-01T17:31:29+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-01T17:31:48+00:00 heroku[web.1]: Starting process with command `honcho -f ProcfileHoncho start`
2013-04-01T17:31:49+00:00 app[web.1]:     load_entry_point('honcho==0.4.0', 'console_scripts', 'honcho')()
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/pkg_resources.py", line 337, in load_entry_point
2013-04-01T17:31:49+00:00 app[web.1]:     return get_distribution(dist).load_entry_point(group, name)
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/pkg_resources.py", line 2279, in load_entry_point
2013-04-01T17:31:49+00:00 app[web.1]:     return ep.load()
2013-04-01T17:31:49+00:00 app[web.1]: Traceback (most recent call last):
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/bin/honcho", line 9, in <module>
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/pkg_resources.py", line 1989, in load
2013-04-01T17:31:49+00:00 app[web.1]:     entry = __import__(self.module_name, globals(),globals(), ['__name__'])
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py", line 66, in <module>
2013-04-01T17:31:49+00:00 app[web.1]:     class Honcho(object):
2013-04-01T17:31:49+00:00 app[web.1]:     default=os.environ['USERNAME' if compat.ON_WINDOWS else 'USER'],
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py", line 205, in Honcho
2013-04-01T17:31:49+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/UserDict.py", line 23, in __getitem__
2013-04-01T17:31:49+00:00 app[web.1]:     raise KeyError(key)
2013-04-01T17:31:49+00:00 app[web.1]: KeyError: 'USER'
2013-04-01T17:31:50+00:00 heroku[web.1]: Process exited with status 1
2013-04-01T17:31:50+00:00 heroku[web.1]: State changed from starting to crashed

Expected behaviour: tasks defined in ProcfileHoncho are started correctly
Temporary workaround: define USER variable on heroku:

heroku config:set USER=heroku

Reply to this email directly or view it on GitHub:
#33

Loading

@dasty
Copy link
Author

@dasty dasty commented Apr 2, 2013

Thank you very much for offering the fix!!!

Out of interest, can I ask why you're using honcho on Heroku rather than using Heroku's native Procfile support?

Of course: I am just being cheap during development and I am running multiple processes within one Dyno using approach described at http://heyman.info/2012/dec/6/heroku-multiple-processes-single-dyno-with-foreman/ with one modification. I did not want to be mix ruby and python, so I rather decided to use honcho than foreman.

Thanks,
Radek

Loading

@pombredanne
Copy link
Contributor

@pombredanne pombredanne commented Apr 5, 2013

FWIW, the same issue existed on Windows and there was a tiny fix just for this here:

default=os.environ['USERNAME' if compat.ON_WINDOWS else 'USER'],

But frankly it puzzles me as to why a modern posix shell would not have USER defined... though this is a possibility and I wonder is using LOGNAME as fallback if USER is not there would work, possibly on Heroku too.
This thread shed some light on the topic: http://www.unix.com/shell-programming-scripting/152400-unix-user-logname-environment-variables.html
Samba for instance tests both: USER then LOGNAME: http://www.samba.org/samba/docs/man/manpages-3/smbclient.1.html

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants