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

Nil pointer dereference when user from Graph API doesn't have Mail field #37

Closed
MatthewDorner opened this issue Feb 23, 2020 · 1 comment · Fixed by #52
Closed

Nil pointer dereference when user from Graph API doesn't have Mail field #37

MatthewDorner opened this issue Feb 23, 2020 · 1 comment · Fixed by #52
Assignees
Labels
Type/Bug Something isn't working
Milestone

Comments

@MatthewDorner
Copy link
Collaborator


Panic occurs when the user retrieved from Graph API doesn't have a Mail field. I got this error when setting up the plugin for development, since I have Azure AD but I don't have Office 365 attached to it and my user has no e-mail.

DEBU[2020-02-20T16:38:43.831909-06:00] Received HTTP request                         caller="web/handlers.go:79" method=POST request_id=gxaz1dddcfyaxribxfsgjrg8mc url=/api/v4/channels/members/me/view
DEBU[2020-02-20T16:38:45.9117403-06:00] Received HTTP request                         caller="web/handlers.go:79" method=POST request_id=5rft8t3mftn6xqk9xhotyshiya url=/api/v4/channels/members/me/view
DEBU[2020-02-20T16:38:47.1997569-06:00] panic: runtime error: invalid memory address or nil pointer dereference  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1998222-06:00] [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd09480]  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.199837-06:00]                                               caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1998491-06:00] goroutine 14 [running]:                       caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.199864-06:00] github.com/mattermost/mattermost-plugin-mscalendar/server/remote/msgraph.(*client).GetMe(0xc0003ab980, 0x11d5ea0, 0xc000024130, 0xc0002d8ae0)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1998785-06:00]     /home/owner/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/remote/msgraph/get_me.go:17 +0x1b0  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1999044-06:00] github.com/mattermost/mattermost-plugin-mscalendar/server/mscalendar.(*oauth2App).CompleteOAuth2(0xc00036c700, 0xc000027720, 0x1a, 0xc00002c616, 0x54f, 0xc00002cb9f, 0x2a, 0xc0004477d0, 0x40e0e8)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1999197-06:00]     /home/owner/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/mscalendar/oauth2.go:94 +0x512  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1999388-06:00] github.com/mattermost/mattermost-plugin-mscalendar/server/utils/oauth2connect.(*oa).oauth2Complete(0xc00036c710, 0x11d2fa0, 0xc00012a950, 0xc000112500)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1999526-06:00]     /home/owner/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/utils/oauth2connect/oauth2_complete.go:24 +0x11e  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.199966-06:00] net/http.HandlerFunc.ServeHTTP(0xc00036c850, 0x11d2fa0, 0xc00012a950, 0xc000112500)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1999788-06:00]     /usr/local/go/src/net/http/server.go:2007 +0x44  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.1999905-06:00] github.com/gorilla/mux.(*Router).ServeHTTP(0xc00022a9c0, 0x11d2fa0, 0xc00012a950, 0xc000112300)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.200004-06:00]     /home/owner/go/pkg/mod/github.com/gorilla/mux@v1.7.3/mux.go:212 +0xe2  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2000167-06:00] github.com/mattermost/mattermost-plugin-mscalendar/server/plugin.(*Plugin).ServeHTTP(0xc00013c500, 0xc000031320, 0x11d2fa0, 0xc00012a950, 0xc000112300)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2000299-06:00]     /home/owner/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/plugin/plugin.go:195 +0x14d  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2000687-06:00] github.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ServeHTTP(0xc0001190e0, 0xc00042b440, 0x1abcc88, 0x0, 0x0)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2000816-06:00]     /home/owner/go/pkg/mod/github.com/mattermost/mattermost-server/v5@v5.20.1/plugin/client_rpc.go:362 +0x2c3  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2000947-06:00] reflect.Value.call(0xc000115c20, 0xc00011c610, 0x13, 0x109a9d0, 0x4, 0xc0002d2f18, 0x3, 0x3, 0x0, 0x0, ...)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001076-06:00]     /usr/local/go/src/reflect/value.go:460 +0x5f6  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001193-06:00] reflect.Value.Call(0xc000115c20, 0xc00011c610, 0x13, 0xc0003ccf18, 0x3, 0x3, 0xc0000b0730, 0xc000024c70, 0xc)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001317-06:00]     /usr/local/go/src/reflect/value.go:321 +0xb4  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001429-06:00] net/rpc.(*service).call(0xc000123f80, 0xc000142820, 0xc00011f420, 0xc00011f430, 0xc00013cf80, 0xc0001197c0, 0xdbaf80, 0xc00042b440, 0x16, 0xdd4580, ...)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001615-06:00]     /usr/local/go/src/net/rpc/server.go:377 +0x16f  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001727-06:00] created by net/rpc.(*Server).ServeCodec       caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2001853-06:00]     /usr/local/go/src/net/rpc/server.go:474 +0x42b  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.mscalendar
ERRO[2020-02-20T16:38:47.2014353-06:00] Plugin failed to ServeHTTP, RPC call failed   caller="mlog/log.go:175" error="unexpected EOF" plugin_id=com.mattermost.mscalendar
DEBU[2020-02-20T16:38:47.2014992-06:00] plugin process exited                         caller="plugin/hclog_adapter.go:51" plugin_id=com.mattermost.mscalendar wrapped_extras="pathplugins/com.mattermost.mscalendar/server/dist/plugin-linux-amd64pid11650errorexit status 2"
@larkox
Copy link
Contributor

larkox commented Mar 2, 2020

I will be working on this issue

@larkox larkox self-assigned this Mar 2, 2020
@levb levb added the Bug label Mar 3, 2020
@levb levb added this to the 0.1.0 milestone Mar 3, 2020
@hanzei hanzei added Type/Bug Something isn't working and removed Bug labels Mar 7, 2020
@larkox larkox added this to To do in Integrations Team via automation Mar 18, 2020
@larkox larkox moved this from To do to In progress in Integrations Team Mar 18, 2020
@hanzei hanzei moved this from In progress to Submitted in Integrations Team Mar 31, 2020
@larkox larkox closed this as completed in #52 Apr 7, 2020
Integrations Team automation moved this from Submitted to Done Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type/Bug Something isn't working
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants