# Getting "Error: TypeError: Cannot read property 'login' of undefined"

**URL:** <https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41>\
**Category:** Rancher 1.x\
**Created:** [July 9, 2015, 12:36am UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41 "2015-07-09T00:36:30Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 12:36am UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/1 "2015-07-09T00:36:30Z")

</div>

Rancher v0.25.0  
Cattle v0.58.0  
User Interface v0.29.0  
Rancher Compose latest

Hooked up to github authentication and behind an nginx proxy.

[https://goo.gl/photos/zNmHvRUC7uFsrerM9](https://goo.gl/photos/zNmHvRUC7uFsrerM9)

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [July 9, 2015, 6:02am UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/2 "2015-07-09T06:02:48Z")

</div>

Can you provide more details on what steps you took to get this error? We’d like to try and reproduce it.

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 12:56pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/3 "2015-07-09T12:56:04Z")

</div>

I didn’t take many steps except "install and github authenticate"  
What is a little different about my setup is that I have an ELB TCP proxying to an nginx container on 443 that then terminates SSL and sends 8080 traffic to the rancher master container.

---

<div class="post-metadata">

**Author:** ![jeremy](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jeremy/32/12_2.png) [@jeremy](https://forums.suse.com/u/jeremy)\
**Post date:** [July 9, 2015, 4:26pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/4 "2015-07-09T16:26:26Z")

</div>

If you go to the main menu on the top right of Rancher and select “Host Registration”, is your address set to the URL that is used to publicly access your Rancher instance? That same public URL obviously also has to be the callback URL for Github auth.

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 5:00pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/5 "2015-07-09T17:00:31Z")

</div>

@jeremy the instructions for SSL say to set that to a space. Authentication _works_ but in the javascript console I see this:

> [https://rancher.nacho.space/github/users/tobowers](https://rancher.nacho.space/github/users/tobowers) Failed to load resource: the server responded with a status of 502 (Bad Gateway)

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 9, 2015, 5:06pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/6 "2015-07-09T17:06:22Z")

</div>

The host registration is the URL that the agents use to talk to the `rancher/server` container. It is usually, but does not necessarily need to be the same as the URL that is used for public access to the API/UI.

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 5:32pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/7 "2015-07-09T17:32:43Z")

</div>

@vincent - so setting the host registration url to my internal URI allows me to have hosts that aren’t reaching through the public API. However, I still get the 502s in the javascript console.

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 5:44pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/8 "2015-07-09T17:44:52Z")

</div>

Skipping over nginx I see rancher is returning:

{“id”:“5a754911-512d-4a85-a8f5-016e3522b0af”,“type”:“error”,“links”:{},“actions”:{},“status”:500,“code”:“Internal Server Error”,“message”:“Internal Server Error”,“detail”:null}

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 5:49pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/9 "2015-07-09T17:49:12Z")

</div>

And for more info… I was able to add a _team_ to an environment, but I cannot add individual users.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 9, 2015, 5:53pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/10 "2015-07-09T17:53:17Z")

</div>

There’s a proxy in rancher to send requests to `/github/` to their API and passes the response back to the UI, because it can’t talk directly to GitHub. So that’s used when you type in a name to find out if it exists and what the name/avatar/etc are. Teams work slightly differently and doesn’t require a hit to the proxy, which is why they work (there isn’t an avatar for a team, and they can’t be looked up by name in the API).

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 6:45pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/11 "2015-07-09T18:45:01Z")

</div>

@vincent - cool… that makes sense. How do I fix it? I need to have the Host Registration set to my internal DNS for agents to join.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 9, 2015, 6:54pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/12 "2015-07-09T18:54:49Z")

</div>

The Host registration URL is only used for…host registration. It had nothing to do with this issue.

The UI is missing an error check to the message you see on the screen comes from there, but ultimately the problem is it didn’t get back a 200 and a json blob about you. So to fix it we need to figure out why you’re getting back a 500 and where it’s coming from. It could be GitHub returning 500 and we’re passing it along, but more likely there’s an unhandled exception in cattle and that’s our generic 500 error. Is there anything like a stack trace in `rancher/server` logs after hitting the URL?

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 7:02pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/13 "2015-07-09T19:02:43Z")

</div>

Ooo… indeed there is (I missed that before)

```
2015-07-09 19:00:51,797 ERROR [:] [] [] [] [qtp688652575-43] [i.g.i.g.r.handler.ExceptionHandler] Exception in API for request [io.github.ibuildthecloud.gdapi.request.ApiRequest@2000547a] java.lang.IllegalStateException: Can not set a value on a null target
	at io.cattle.platform.object.util.DataAccessor.getTargetMap(DataAccessor.java:175) ~[cattle-framework-object-0.5.0-SNAPSHOT.jar:na]
	at io.cattle.platform.object.util.DataAccessor.get(DataAccessor.java:147) ~[cattle-framework-object-0.5.0-SNAPSHOT.jar:na]
	at io.cattle.platform.iaas.api.auth.github.GithubUtils.getAccessToken(GithubUtils.java:263) ~[cattle-iaas-auth-logic-0.5.0-SNAPSHOT.jar:na]
	at io.cattle.platform.iaas.api.request.handler.GithubProxy.generate(GithubProxy.java:37) ~[cattle-iaas-auth-logic-0.5.0-SNAPSHOT.jar:na]
	at io.github.ibuildthecloud.gdapi.request.handler.AbstractResponseGenerator.handle(AbstractResponseGenerator.java:14) ~[gdapi-java-server-0.11.1.1.jar:na]
	at io.github.ibuildthecloud.gdapi.servlet.ApiRequestFilterDelegate.doFilter(ApiRequestFilterDelegate.java:88) ~[gdapi-java-server-0.11.1.1.jar:na]
	at io.cattle.platform.api.servlet.ApiRequestFilter$1.runInContext(ApiRequestFilter.java:60) [cattle-framework-api-0.5.0-SNAPSHOT.jar:na]
	at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49) [cattle-framework-managed-context-0.5.0-SNAPSHOT.jar:na]
	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55) [cattle-framework-managed-context-0.5.0-SNAPSHOT.jar:na]
	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:108) [cattle-framework-managed-context-0.5.0-SNAPSHOT.jar:na]
	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52) [cattle-framework-managed-context-0.5.0-SNAPSHOT.jar:na]
	at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46) [cattle-framework-managed-context-0.5.0-SNAPSHOT.jar:na]
	at io.cattle.platform.api.servlet.ApiRequestFilter.doFilter(ApiRequestFilter.java:53) [cattle-framework-api-0.5.0-SNAPSHOT.jar:na]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) [jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:82) [jetty-servlets-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:294) [jetty-servlets-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) [jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) [jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) [jetty-security-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384) [jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.Server.handle(Server.java:370) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) [jetty-http-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) [jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668) [jetty-io-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) [jetty-io-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) [jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) [jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
```

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 9, 2015, 9:06pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/14 "2015-07-09T21:06:12Z")

</div>

@wizardofmath can you look at --^

---

<div class="post-metadata">

**Author:** ![wizardofmath](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/wizardofmath/32/23_2.png) [@wizardofmath](https://forums.suse.com/u/wizardofmath)\
**Post date:** [July 9, 2015, 9:23pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/15 "2015-07-09T21:23:18Z")

</div>

Looks like there is a path in cattle that is allowing you to hit the github proxy without an AccessToken for github stored/ loaded and as a result when it tries to retrieve the token it errors. Without having access to it locally to debug I cannot say for certain what the exact cause but that is what it seems to be based on the provided stacktrace.

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 9, 2015, 10:32pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/16 "2015-07-09T22:32:26Z")

</div>

Happy to help with a screenshare, etc

---

<div class="post-metadata">

**Author:** ![tobowers](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tobowers/32/22_2.png) [@tobowers](https://forums.suse.com/u/tobowers)\
**Post date:** [July 10, 2015, 3:16pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/17 "2015-07-10T15:16:13Z")

</div>

Could this be related?

> WebSocket connection to ‘wss://#{redacted\_host\_name}/v1/stats/#{redacted\_long\_token}’ failed: HTTP \> Authentication failed; no valid credentials available

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 12, 2015, 1:16am UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/18 "2015-07-12T01:16:40Z")

</div>

Update for those playing along at home. Thanks to a screenshare with @tobowers we were able to track down the cause of this issue, which is the `proxy_buffer_size`, which the [SSL setup instructions](http://rancher.docs.rancher.com/docs/installing-rancher/installing-server/basic-ssl-config/) tell you to put into the nginx config. That particular buffer length is needed for host -\> rancher/server connections to work correctly though. We’ll be working on resolving this so that SSL + GitHub + host connections can all work at the same time.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [July 27, 2015, 8:42pm UTC](https://forums.suse.com/t/getting-error-typeerror-cannot-read-property-login-of-undefined/41/19 "2015-07-27T20:42:55Z")

</div>


