Skip to content

'restock' is undefined #3490

@geekho-me

Description

@geekho-me

Describe the bug
When you have a global Notification Body configured which includes restock.price and/or restock.original_price; if you send a notification from a standard Webpage Text/HTML, JSON and PDF changes detection, the notification fails to send with the notification error:

Notification Log:

SENDING - null
'restock' is undefined

Version
v0.50.21

How did you install?

Docker

To Reproduce

Steps to reproduce the behavior:

  1. Go to SETTINGS
  2. Click on Notifications
  3. Set Notification Title to: {{watch_title}}
  4. Set Notification Body to:
{
  "base_url": {{base_url|default('')|tojson}},
  "watch_url": {{watch_url|default('')|tojson}},
  "watch_uuid": {{watch_uuid|default('')|tojson}},
  "watch_title": {{watch_title|default('')|tojson}},
  "watch_tag": {{watch_tag|default('')|tojson}},
  "preview_url": {{preview_url|default('')|tojson}},
  "diff_url": {{diff_url|default('')|tojson}},
  "diff": {{(diff or '')[:3500]|tojson}},
  "diff_added": {{(diff_added or '')[:3500]|tojson}},
  "diff_removed": {{(diff_removed or '')[:3500]|tojson}},
  "diff_full": {{(diff_full or '')[:3500]|tojson}},
  "diff_patch": {{(diff_patch or '')[:3500]|tojson}},
  "current_snapshot": {{(current_snapshot or '')[:3500]|tojson}},
  "triggered_text": {{triggered_text|default('')|tojson}},
  "restock_price": {{restock.price|default('')|tojson}},
  "restock_original_price": {{restock.original_price|default('')|tojson}}
}
  1. Set Notification format to: Text
  2. Press Save button
  3. Recheck your default Hacker News detection (https://news.ycombinator.com/) to trigger a detection
  4. Error occurs

Expected behavior

Successfully send a notification

Screenshots

Image

Additional context
I suppose this is somewhat expected to happen as the check is not a restock check; however it would be useful to have these fields default to null so you do not need custom notifications per check.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions