[GH-ISSUE #1228] $NTFY_RAW returns unmarshaled Go object instead of JSON in shell script #865

Closed
opened 2026-05-07 00:28:17 +02:00 by BreizhHardware · 1 comment

Originally created by @tessamerrill on GitHub (Dec 4, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1228

🐞 Describe the bug

$NTFY_RAW is returning a stringified Go object instead of JSON in a Shell script

💻 Components impacted

ntfy client CLI

💡 Screenshots and/or logs

2024/12/04 13:25:49 TRACE 192.168.1.167:8040/ntfy-raw-test-script Message received: {"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"}
2024/12/04 13:25:49 DEBUG 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL Dispatching received message: {"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"}
2024/12/04 13:25:49 DEBUG 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL Running command '~/.config/ntfy/test.sh' via temporary script /tmp/ntfy-subscribe-2TpOASCYKb.sh
2024/12/04 13:25:49 DEBUG 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL Executing script /tmp/ntfy-subscribe-2TpOASCYKb.sh
2024/12/04 13:25:49 TRACE 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL With environment:
NTFY_ID=xElNtvMta1sL
NTFY_MESSAGE=This is a test Script
NTFY_PRIORITY=0
NTFY_RAW={"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"}
NTFY_TAGS=
NTFY_TIME=1733336750
NTFY_TITLE=Test Script
NTFY_TOPIC=ntfy-raw-test-script
id=xElNtvMta1sL
m=This is a test Script
message=This is a test Script
p=0
prio=0
priority=0
raw={"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"}
t=Test Script
ta=
tag=
tags=
time=1733336750
title=Test Script
topic=ntfy-raw-test-script
NTFY_RAW: id:xElNtvMta1sL time:1733336750 expires:1733379950 event:message topic:ntfy-raw-test-script title:Test Script message:This is a test Script
2024/12/04 13:25:50 TRACE 192.168.1.167:8040/jellyseer Message received: {"id":"R9b3dylIgVyC","time":1733336750,"event":"keepalive","topic":"jellyseer"}
2024/12/04 13:25:50 TRACE 192.168.1.167:8040/ntfy-raw-test Message received: {"id":"c6vMEelpPcPU","time":1733336750,"event":"keepalive","topic":"ntfy-raw-test"}
2024/12/04 13:25:50 TRACE 192.168.1.167:8040/ntfy-raw-test-script Message received: {"id":"d8Vh1z3kNGhg","time":1733336750,"event":"keepalive","topic":"ntfy-raw-test-script"}

🔮 Additional context

test.sh:

#!/bin/bash

eval "echo NTFY_RAW: $NTFY_RAW"
Originally created by @tessamerrill on GitHub (Dec 4, 2024). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1228 :lady_beetle: **Describe the bug** <!-- A clear and concise description of the problem. --> `$NTFY_RAW` is returning a stringified Go object instead of JSON in a Shell script :computer: **Components impacted** <!-- ntfy server, Android app, iOS app, web app --> ntfy client CLI :bulb: **Screenshots and/or logs** ``` 2024/12/04 13:25:49 TRACE 192.168.1.167:8040/ntfy-raw-test-script Message received: {"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"} 2024/12/04 13:25:49 DEBUG 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL Dispatching received message: {"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"} 2024/12/04 13:25:49 DEBUG 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL Running command '~/.config/ntfy/test.sh' via temporary script /tmp/ntfy-subscribe-2TpOASCYKb.sh 2024/12/04 13:25:49 DEBUG 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL Executing script /tmp/ntfy-subscribe-2TpOASCYKb.sh 2024/12/04 13:25:49 TRACE 192.168.1.167:8040/ntfy-raw-test-script/xElNtvMta1sL With environment: NTFY_ID=xElNtvMta1sL NTFY_MESSAGE=This is a test Script NTFY_PRIORITY=0 NTFY_RAW={"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"} NTFY_TAGS= NTFY_TIME=1733336750 NTFY_TITLE=Test Script NTFY_TOPIC=ntfy-raw-test-script id=xElNtvMta1sL m=This is a test Script message=This is a test Script p=0 prio=0 priority=0 raw={"id":"xElNtvMta1sL","time":1733336750,"expires":1733379950,"event":"message","topic":"ntfy-raw-test-script","title":"Test Script","message":"This is a test Script"} t=Test Script ta= tag= tags= time=1733336750 title=Test Script topic=ntfy-raw-test-script NTFY_RAW: id:xElNtvMta1sL time:1733336750 expires:1733379950 event:message topic:ntfy-raw-test-script title:Test Script message:This is a test Script 2024/12/04 13:25:50 TRACE 192.168.1.167:8040/jellyseer Message received: {"id":"R9b3dylIgVyC","time":1733336750,"event":"keepalive","topic":"jellyseer"} 2024/12/04 13:25:50 TRACE 192.168.1.167:8040/ntfy-raw-test Message received: {"id":"c6vMEelpPcPU","time":1733336750,"event":"keepalive","topic":"ntfy-raw-test"} 2024/12/04 13:25:50 TRACE 192.168.1.167:8040/ntfy-raw-test-script Message received: {"id":"d8Vh1z3kNGhg","time":1733336750,"event":"keepalive","topic":"ntfy-raw-test-script"} ``` :crystal_ball: **Additional context** test.sh: ```sh #!/bin/bash eval "echo NTFY_RAW: $NTFY_RAW" ```
BreizhHardware 2026-05-07 00:28:17 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@tessamerrill commented on GitHub (Dec 7, 2024):

turns out using eval and echo was breaking things

<!-- gh-comment-id:2524708801 --> @tessamerrill commented on GitHub (Dec 7, 2024): turns out using eval and echo was breaking things
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/ntfy#865
No description provided.