Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook sink throws Type Error when trying to write JSON #1405

Open
avbtrifork opened this issue May 7, 2024 · 1 comment
Open

Webhook sink throws Type Error when trying to write JSON #1405

avbtrifork opened this issue May 7, 2024 · 1 comment

Comments

@avbtrifork
Copy link

To Reproduce
Steps to reproduce the behavior:
Give the config:

globalConfig:
  signing_key: <>
  account_id: <>
sinksConfig:
  - robusta_sink:
      name: robusta_ui_sink
      token: <>
  - slack_sink:
      name: dev_sink
      slack_channel: robusta
      api_key: <>
      stop: false
  - webhook_sink:
      name: webhook_sink
      url: <>
      format: "json"
enablePrometheusStack: false
enablePlatformPlaybooks: true
runner:
  sendAdditionalTelemetry: false

customPlaybooks:
- triggers:
    - on_deployment_update:
        change_filters:
          ignore: # These are ignored by default
          - status
          - metadata.generation
          - metadata.resourceVersion
          - metadata.managedFields
          - spec.replicas
          include:
            - spec.template.spec.containers[0]
            - spec.strategy
  actions:
    - resource_babysitter: {}
    - customise_finding:
        severity: MEDIUM
        title: "New changes in $kind/$namespace/$name"
  sinks:
    - dev_sink # Optional
    - webhook_sink

Expected behavior
I would expect to have a JSON payload posted to the webhook URL.

Additional context

TypeError: keys must be str, int, float, bool or None, not type
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.9/json/encoder.py", line 257, in iterencode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.9/json/encoder.py", line 199, in encode
    return cls(
  File "/usr/local/lib/python3.9/json/__init__.py", line 234, in dumps
    finding_dict = json.loads(json.dumps(finding, default=lambda o: getattr(o, '__dict__', str(o))))
  File "/app/src/robusta/core/sinks/webhook/webhook_sink.py", line 75, in __write_json
    self.__write_json(finding, platform_enabled)
  File "/app/src/robusta/core/sinks/webhook/webhook_sink.py", line 32, in write_finding
    sink.write_finding(finding_copy, self.registry.get_sinks().platform_enabled)
  File "/app/src/robusta/core/playbooks/playbooks_event_handler_impl.py", line 317, in __handle_findings
Traceback (most recent call last):
2024-05-06 13:45:23.593 ERROR    Failed to publish finding to sink webhook_sink
Copy link

github-actions bot commented May 7, 2024

Hi 👋, thanks for opening an issue! Please note, it may take some time for us to respond, but we'll get back to you as soon as we can!

  • 💬 Slack Community: Join Robusta team and other contributors on Slack here.
  • 📖 Docs: Find our documentation here.
  • 🎥 YouTube Channel: Watch our videos here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant