[GH-ISSUE #227] failed device token from database #99

Closed
opened 2026-03-03 11:56:03 +03:00 by kerem · 3 comments
Owner

Originally created by @Evilmass on GitHub (Jul 16, 2023).
Original GitHub issue: https://github.com/Finb/bark-server/issues/227

部署平台

树莓派 3B+ aarch64 debian 11

部署方式

docker run -dt --name bark -p 8080:8080 -v `pwd`/bark-data:/data finab/bark-server

推送测试

# Install the Python Requests library:
# `pip install requests`

import requests
import json


def send_request():
    # push
    # POST http://127.0.0.1:8080/push

    try:
        response = requests.post(
            url="http://127.0.0.1:8080/push",
            headers={
                "Content-Type": "application/json; charset=utf-8",
            },
            data=json.dumps({
                "body": "Test Bark Server",
                "device_key": "nysrshcqielvoxsa",
                "title": "bleem",
                "category": "myNotificationCategory",
                "sound": "minuet.caf",
                "badge": 1,
                "icon": "https://day.app/assets/images/avatar.jpg",
                "group": "test",
                "url": "https://mritd.com"
            })
        )
        print('Response HTTP Status Code: {status_code}'.format(
            status_code=response.status_code))
        print('Response HTTP Response Body: {content}'.format(
            content=response.content))
    except requests.exceptions.RequestException:
        print('HTTP Request failed')

错误信息

(base) λ python test_bark.py
Response HTTP Status Code: 400
Response HTTP Response Body: b'{"code":400,"message":"failed to get device token: failed to get [push] device token from database","timestamp":1689500021}'
Originally created by @Evilmass on GitHub (Jul 16, 2023). Original GitHub issue: https://github.com/Finb/bark-server/issues/227 ## 部署平台 树莓派 3B+ aarch64 debian 11 ## 部署方式 ```bash docker run -dt --name bark -p 8080:8080 -v `pwd`/bark-data:/data finab/bark-server ``` ## 推送测试 ```python # Install the Python Requests library: # `pip install requests` import requests import json def send_request(): # push # POST http://127.0.0.1:8080/push try: response = requests.post( url="http://127.0.0.1:8080/push", headers={ "Content-Type": "application/json; charset=utf-8", }, data=json.dumps({ "body": "Test Bark Server", "device_key": "nysrshcqielvoxsa", "title": "bleem", "category": "myNotificationCategory", "sound": "minuet.caf", "badge": 1, "icon": "https://day.app/assets/images/avatar.jpg", "group": "test", "url": "https://mritd.com" }) ) print('Response HTTP Status Code: {status_code}'.format( status_code=response.status_code)) print('Response HTTP Response Body: {content}'.format( content=response.content)) except requests.exceptions.RequestException: print('HTTP Request failed') ``` ## 错误信息 ```bash (base) λ python test_bark.py Response HTTP Status Code: 400 Response HTTP Response Body: b'{"code":400,"message":"failed to get device token: failed to get [push] device token from database","timestamp":1689500021}' ```
kerem closed this issue 2026-03-03 11:56:03 +03:00
Author
Owner

@Evilmass commented on GitHub (Jul 16, 2023):

原来是要先注册 device
http://192.168.1.63:8080/register?devicetoken=<fcm_token>

bark 和 bark-server 教程均无此步骤,建议添加。

<!-- gh-comment-id:1637039099 --> @Evilmass commented on GitHub (Jul 16, 2023): 原来是要先注册 device `http://192.168.1.63:8080/register?devicetoken=<fcm_token>` bark 和 bark-server 教程均无此步骤,建议添加。
Author
Owner

@Evilmass commented on GitHub (Jul 16, 2023):

但是填写注册后的 device_key 依然报错

(base) λ python test_bark.py
Response HTTP Status Code: 500
Response HTTP Response Body: b'{"code":500,"message":"push failed: APNS push failed: BadDeviceToken","timestamp":1689501361}'
<!-- gh-comment-id:1637040732 --> @Evilmass commented on GitHub (Jul 16, 2023): 但是填写注册后的 device_key 依然报错 ```bash (base) λ python test_bark.py Response HTTP Status Code: 500 Response HTTP Response Body: b'{"code":500,"message":"push failed: APNS push failed: BadDeviceToken","timestamp":1689501361}' ```
Author
Owner

@Finb commented on GitHub (Jul 18, 2023):

在APP内添加你的服务器

<!-- gh-comment-id:1639244721 --> @Finb commented on GitHub (Jul 18, 2023): 在APP内添加你的服务器
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bark-server#99
No description provided.