appleboy / appleboy/gorush

HTTP server does not respond

Open
#819 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.8k
Forks
887
PR merge metrics
No merged PRs in 30d

Description

The method `POST` `/api/push` returns: curl: (52) Empty reply from server

All other GET endpoints do not respond as well (empty response).

The gRPC service works well and PUSH message delivered to the device successfully.

### The config:

```yaml
core:
enabled: true
port: "8088"
worker_num: 0
queue_num: 0
max_notification: 100
sync: false
feedback_hook_url: "http://localhost:8888"
feedback_timeout: 30
mode: "debug"
ssl: false
cert_path: "cert.pem"
key_path: "key.pem"
cert_base64: ""
key_base64: ""
http_proxy: ""
pid:
enabled: false
path: "gorush.pid"
override: true

grpc:
enabled: true
port: "9000"

api:
push_uri: "/api/push"
stat_go_uri: "/api/stat/go"
stat_app_uri: "/api/stat/app"
sys_stat_uri: "/sys/stats"
metric_uri: "/metrics"
health_uri: "/healthz"

log:
format: "json"
access_log: "stdout"
access_level: "debug"
error_log: "stderr"
error_level: "error"
hide_token: false
hide_messages: false

android:
enabled: true
max_retry: 3
key_path: /home/gorush/fcm.json

huawei:
enabled: false
max_retry: 3
appid: ""
appsecret: ""

ios:
enabled: false
production: false
max_concurrent_pushes: 100
max_retry: 3
team_id: ""
key_id: ""
key_type: "p8"
key_base64: ""

queue:
engine: "local"

stat:
engine: "memory"
```

### How to run
```sh
docker run --rm --name gorush -v ${PWD}/config/gorush.yml:/home/gorush/config.yml -v ${PWD}/config/fcm.json:/home/gorush/fcm.json -p 8088:8088 -p 9000:9000 appleboy/gorush:1.18.8
```

Logs after running:
```sh
docker pull appleboy/gorush:1.18.8
1.18.8: Pulling from appleboy/gorush
Digest: sha256:1a7a7a90687ed2ee9945908aa583d9dbc21cf64ba706bea79b46dabcc7e566c6
Status: Image is up to date for appleboy/gorush:1.18.8
docker.io/appleboy/gorush:1.18.8

What's next:
View a summary of image vulnerabilities and recommendations → docker scout quickview appleboy/gorush:1.18.8
docker run --rm --name gorush -v ...
Using config file: /home/gorush/config.yml
{"level":"info","msg":"Init App Status Engine as memory","time":"2024-11-16T20:27:07Z"}
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET /api/stat/go --> github.com/appleboy/gin-status-api.GinHandler (5 handlers)
[GIN-debug] GET /api/stat/app --> github.com/appleboy/gorush/router.routerEngine.appStatusHandler.func6 (5 handlers)
[GIN-debug] GET / --> github.com/appleboy/gorush/router.routerEngine.configHandler.func7 (5 handlers)
[GIN-debug] GET /sys/stats --> github.com/appleboy/gorush/router.routerEngine.sysStatsHandler.func8 (5 handlers)
[GIN-debug] POST /api/push --> github.com/appleboy/gorush/router.routerEngine.pushHandler.func9 (5 handlers)
[GIN-debug] GET /metrics --> github.com/appleboy/gorush/router.metricsHandler (5 handlers)
[GIN-debug] GET /healthz --> github.com/appleboy/gorush/router.heartbeatHandler (5 handlers)
[GIN-debug] HEAD /healthz --> github.com/appleboy/gorush/router.heartbeatHandler (5 handlers)
[GIN-debug] GET /version --> github.com/appleboy/gorush/router.versionHandler (5 handlers)
[GIN-debug] GET / --> github.com/appleboy/gorush/router.rootHandler (5 handlers)
{"level":"info","msg":"gRPC server is running on 9000 port.","time":"2024-11-16T20:27:07Z"}
```

### After sending the PUSH
```sh
DEBU[2024/11/16 - 15:19:00] Start push notification for Android
DEBU[2024/11/16 - 15:19:01] Android Success count: 1, Failure count: 0
INFO[2024/11/16 - 15:19:01] {"notif_id":"019336a0-d685-7082-8998-b9b947af61d3","type":"succeeded-push","platform":"android","token":"...","message":"The push tracing ID is: 019336a0-d685-7082-8998-b9b947af61d3","error":""}
```

! The feedback URL did not fired after sending the PUSH as well.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the empty HTTP responses with the supplied gorush.yml configuration and Docker command, starting with the logged Gin routes for /api/push, /healthz, and the other GET endpoints. Trace the HTTP request handling and feedback hook behavior using the available logs; done means the HTTP endpoints return responses and the feedback URL fires after a successful push.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.