etcinit / phabulous

A Phabricator bot for Slack
MIT License
218 stars 47 forks source link

runtime error: invalid memory address or nil pointer dereference #82

Open nradosevic opened 3 years ago

nradosevic commented 3 years ago

Please add the following info when adding an issue:

I am running phabricator on my server and phabulous inside the docker container on the same machine.

Here's my docker-compose.yml:

version: '2'
services:
  phabulous:
    image: quay.io/etcinit/phabulous:v3.0.0-beta1
    environment:
      - SLACK_TOKEN=MY_SLACK_TOKEN
      - CONDUIT_API=MY_PHABRICATOR_URL
      - CONDUIT_TOKEN=MY_PHABRICATOR_TOKEN
    volumes:
      - './config:/go/src/github.com/etcinit/phabulous/config'
    ports:
      - '8085:8085'

And here is my config/main.yml:

server:
  hostname: ''
  port: 8085
  debug: false
  serious: false
  modules:
    - core
slack:
  token: MY_SLACK_TOKEN
  username: phabulous
  enable: true
  as-user: false
irc:
  enable: false
  nick: phabulous
  hostname: some.irc.server
  #password: somethingsecret
  port: 6667
  tls: true
conduit:
  api: MY_PHABRICATOR_URL
  token: MY_PHABRICATOR_TOKEN
channels:
  feed: '#phabricator'
  feedTypes: [] 
  repositories:
    CALLSIGN: '#channel'
    OTHERCALLSIGN: '#otherchannel'
  projects:
    10: '#anotherchannel'
core:
  summon:
    expandProjects: true
    includeSelf: true
misc:
  ignore-ca: false
commands:
  lookup:
    matchers:
      - ([T|D][0-9]{1,16})+
                                                                                                                                                                 115,1         Bot

I also created a webhook in phabricator that targets this URL to push notifications to Slack: http://localhost:8085/v1/feed/receive

However, when I try to test it I see the following error in phabulous docker log:

phabulous_1  | 
phabulous_1  | 
phabulous_1  | 2021/06/24 00:49:15 [Recovery] panic recovered:
phabulous_1  | POST /v1/feed/receive HTTP/1.1
phabulous_1  | Host: localhost:8085
phabulous_1  | Accept: */*
phabulous_1  | Accept-Encoding: gzip
phabulous_1  | Content-Length: 894
phabulous_1  | Content-Type: application/json
phabulous_1  | X-Phabricator-Webhook-Signature: 6644f354ef62d2f9aadefdd8b56697d6f249aa62568a6ab823afe62af02019e0
phabulous_1  | 
phabulous_1  | 
phabulous_1  | runtime error: invalid memory address or nil pointer dereference
phabulous_1  | /usr/local/go/src/runtime/panic.go:489 (0x429eef)
phabulous_1  |  gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
phabulous_1  | /usr/local/go/src/runtime/panic.go:63 (0x428d9e)
phabulous_1  |  panicmem: panic(memoryError)
phabulous_1  | /usr/local/go/src/runtime/signal_unix.go:290 (0x43ed2f)
phabulous_1  |  sigpanic: panicmem()
phabulous_1  | /go/src/github.com/etcinit/phabulous/app/controllers/feed.go:56 (0x84b6b1)
phabulous_1  |  (*FeedController).postReceive: if res.URI != "" {
phabulous_1  | /go/src/github.com/etcinit/phabulous/app/controllers/feed.go:30 (0x84ce44)
phabulous_1  |  postReceive)-fm: front.POST("/receive", f.postReceive)
phabulous_1  | /go/src/github.com/gin-gonic/gin/context.go:97 (0x83995a)
phabulous_1  |  (*Context).Next: c.handlers[c.index](c)
phabulous_1  | /go/src/github.com/gin-gonic/gin/recovery.go:45 (0x848daa)
phabulous_1  |  RecoveryWithWriter.func1: c.Next()
phabulous_1  | /go/src/github.com/gin-gonic/gin/context.go:97 (0x83995a)
phabulous_1  |  (*Context).Next: c.handlers[c.index](c)
phabulous_1  | /go/src/github.com/gin-gonic/gin/logger.go:72 (0x84807f)
phabulous_1  |  LoggerWithWriter.func1: c.Next()
phabulous_1  | /go/src/github.com/gin-gonic/gin/context.go:97 (0x83995a)
phabulous_1  |  (*Context).Next: c.handlers[c.index](c)
phabulous_1  | /go/src/github.com/gin-gonic/gin/gin.go:284 (0x83fba0)
phabulous_1  |  (*Engine).handleHTTPRequest: context.Next()
phabulous_1  | /go/src/github.com/gin-gonic/gin/gin.go:265 (0x83f4bb)
phabulous_1  |  (*Engine).ServeHTTP: engine.handleHTTPRequest(c)
phabulous_1  | /usr/local/go/src/net/http/server.go:2568 (0x6ccf62)
phabulous_1  |  serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
phabulous_1  | /usr/local/go/src/net/http/server.go:1825 (0x6c91d2)
phabulous_1  |  (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
phabulous_1  | /usr/local/go/src/runtime/asm_amd64.s:2197 (0x455dd1)
phabulous_1  |  goexit: BYTE    $0x90   // NOP
phabulous_1  | 
phabulous_1  | [GIN] 2021/06/24 - 00:49:15 | 500 |  623.575137ms | 172.22.0.1 |   POST    /v1/feed/receive
nradosevic commented 3 years ago

This is what happens when I use the phabricator Webhook test request.

However, when I add the comment to an existing revision I get a different error:

phabulous_1  | [GIN] 2021/06/24 - 01:46:21 | 200 |  502.714436ms | 172.22.0.1 |   POST    /v1/feed/receive
phabulous_1  | time="2021-06-24T01:46:21Z" level=error msg="json: cannot unmarshal object into Go struct field DifferentialRevision.reviewers of type []string"