Skip to content

echobot example has problems #69

@XANi

Description

@XANi

I ran near-unchanged (changed port to 8080) echobot from samples directory and got nil panic:

Starting server on port:8080...
2022/10/05 19:38:27 http: panic serving 10.100.199.14:11078: runtime error: invalid memory address or nil pointer dereference
goroutine 18 [running]:
net/http.(*conn).serve.func1()
	/usr/lib/go-1.18/src/net/http/server.go:1825 +0xbf
panic({0x6e4640, 0x962d50})
	/usr/lib/go-1.18/src/runtime/panic.go:844 +0x258
github.com/infracloudio/msbotbuilder-go/connector/client.(*ConnectorClient).getToken(0xc00010c000, {0x7b8b80, 0xc0000a8000})
	/tmp/msbotbuilder-go/connector/client/client.go:178 +0x9c9
github.com/infracloudio/msbotbuilder-go/connector/client.(*ConnectorClient).sendRequest(_, _, {{0x730559, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, ...}, ...})
	/tmp/msbotbuilder-go/connector/client/client.go:116 +0x55
github.com/infracloudio/msbotbuilder-go/connector/client.(*ConnectorClient).Post(_, {_, _}, {{0xc0000a66f0, 0x5}, {0x0, 0x0}, 0x0, {0xc0000a66f8, 0x17}, ...}, ...)
	/tmp/msbotbuilder-go/connector/client/client.go:84 +0x19b
github.com/infracloudio/msbotbuilder-go/core/activity.(*DefaultResponse).SendActivity(_, {_, _}, {{0x730559, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, ...})
	/tmp/msbotbuilder-go/core/activity/response.go:84 +0x2cd
github.com/infracloudio/msbotbuilder-go/core.(*BotFrameworkAdapter).ProcessActivity(_, {_, _}, {{0xc0000a9950, 0x7}, {0xc0000a99a3, 0xd}, {0x1cd06634, 0xedacfb812, 0x0}, ...}, ...)
	/tmp/msbotbuilder-go/core/bot_framework_adapter.go:115 +0x1b9
main.(*HTTPHandler).processMessage(0xc00009ed20, {0x7b8968, 0xc00010c1c0}, 0x4cef69?)
	/tmp/msbotbuilder-go/samples/echobot/main.go:36 +0x20d
net/http.HandlerFunc.ServeHTTP(0x6d3660?, {0x7b8968?, 0xc00010c1c0?}, 0xc00012c080?)
	/usr/lib/go-1.18/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x7b8968, 0xc00010c1c0}, 0xc00012a000)
	/usr/lib/go-1.18/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0x7b7b20?}, {0x7b8968, 0xc00010c1c0}, 0xc00012a000)
	/usr/lib/go-1.18/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0000bcb40, {0x7b8bf0, 0xc0000a3230})
	/usr/lib/go-1.18/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	/usr/lib/go-1.18/src/net/http/server.go:3071 +0x4db
2022/10/05 19:38:28 http: panic serving 10.100.199.12:50088: runtime error: invalid memory address or nil pointer dereference
goroutine 26 [running]:
net/http.(*conn).serve.func1()
	/usr/lib/go-1.18/src/net/http/server.go:1825 +0xbf
panic({0x6e4640, 0x962d50})
	/usr/lib/go-1.18/src/runtime/panic.go:844 +0x258
github.com/infracloudio/msbotbuilder-go/connector/client.(*ConnectorClient).getToken(0xc00010c000, {0x7b8b80, 0xc0000a8000})
	/tmp/msbotbuilder-go/connector/client/client.go:178 +0x9c9
github.com/infracloudio/msbotbuilder-go/connector/client.(*ConnectorClient).sendRequest(_, _, {{0x730559, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, ...}, ...})
	/tmp/msbotbuilder-go/connector/client/client.go:116 +0x55
github.com/infracloudio/msbotbuilder-go/connector/client.(*ConnectorClient).Post(_, {_, _}, {{0xc0005c8180, 0x5}, {0x0, 0x0}, 0x0, {0xc0005c8188, 0x17}, ...}, ...)
	/tmp/msbotbuilder-go/connector/client/client.go:84 +0x19b
github.com/infracloudio/msbotbuilder-go/core/activity.(*DefaultResponse).SendActivity(_, {_, _}, {{0x730559, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, ...})
	/tmp/msbotbuilder-go/core/activity/response.go:84 +0x2cd
github.com/infracloudio/msbotbuilder-go/core.(*BotFrameworkAdapter).ProcessActivity(_, {_, _}, {{0xc0003301d0, 0x7}, {0xc0003301e0, 0xd}, {0x1cd06634, 0xedacfb812, 0x0}, ...}, ...)
	/tmp/msbotbuilder-go/core/bot_framework_adapter.go:115 +0x1b9
main.(*HTTPHandler).processMessage(0xc00009ed20, {0x7b8968, 0xc00010c2a0}, 0xc000204100?)
	/tmp/msbotbuilder-go/samples/echobot/main.go:36 +0x20d
net/http.HandlerFunc.ServeHTTP(0x0?, {0x7b8968?, 0xc00010c2a0?}, 0xc00012c0c0?)
	/usr/lib/go-1.18/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x7b8968, 0xc00010c2a0}, 0xc000204100)
	/usr/lib/go-1.18/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0x7b7b20?}, {0x7b8968, 0xc00010c2a0}, 0xc000204100)
	/usr/lib/go-1.18/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0000bcd20, {0x7b8bf0, 0xc0000a3230})
	/usr/lib/go-1.18/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	/usr/lib/go-1.18/src/net/http/server.go:3071 +0x4db

I've captured the request

POST /api/messages HTTP/1.1
authorization: Bearer <redacted>
x-ms-conversation-id: <redacted>
x-ms-tenant-id: <redacted>
user-agent: Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0)
ms-cv: <redacted>
content-type: application/json; charset=utf-8
host: <redacted>
content-length: 1055
x-forwarded-proto: https
x-forwarded-for: 52.113.205.15
connection: close

{"text":"testbot ","textFormat":"plain","attachments":[{"contentType":"text/html","content":"<p>testbot </p>"}],"type":"message","timestamp":"2022-10-05T17:40:48.2890875Z","localTimestamp":"2022-10-05T19:40:48.2890875+02:00","id":"1664991648254","channelId":"msteams","serviceUrl":"https://smba.trafficmanager.net/emea/","from":{"id":"29:17Tq-xb-FxJqethEHuG1XHhISPVERKQZO9AfLaR8tKckt1f1Lmfv1rkFr6LRO2Ok9NQyVsvmseJTQE2UsKnVnVw","name":"<redacted>","aadObjectId":"<redacted>"},"conversation":{"conversationType":"personal","tenantId":"<redacted>","id":"a:1Wa3YlVHUQoiefkiY_LBvhvffdgm1qBVPPvlakMDeWY031MShWvqA4XpXMaJijhzoSWfwQr5jx04CYptl2lhNtLelbIzV4Py7AIGwCkANBrtrjHHonC_hYp8fZijny6Kj"},"recipient":{"id":"28:7d7fb618-9d5c-4c42-b4e7-95030b5fb9e9","name":"testbot"},"entities":[{"locale":"en-US","country":"US","platform":"Web","timezone":"Europe/Warsaw","type":"clientInfo"}],"channelData":{"tenant":{"id":"<redacted>"}},"locale":"en-US","localTimezone":"Europe/Warsaw"}

but it looks just fine...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions