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

UnicodeDecodeError: don't know how to handle UnicodeDecodeError in error callback #550

Closed
faizanmansuri opened this issue Oct 9, 2023 · 2 comments

Comments

@faizanmansuri
Copy link

I am trying to create a saved search (type alert) on Splunk using python-sdk.
The problem I am facing is the alert gets created with the proper fields but it still throws an error
UnicodeDecodeError: don't know how to handle UnicodeDecodeError in error callback.

To Reproduce
Steps to reproduce the behavior:

  1. Install python-sdk and write a python code for creating saved search following README.md of python-sdk
  2. Create a saved search having below values
alert_content = {
    "name": "Test Alert",
    "search": "QUERY",
    "alert_type": "number of events",
    "is_scheduled": "true",
    "cron_schedule": "0 9 * * 1",
    "alert_comparator": "greater than",
    "alert_threshold": 0,
    "app": "search",
    "actions": "email",
    "action.email": 1,
    "action.email.to": "[email protected]",
}
  1. It would look something like this
self.service.saved_searches.create(**alert_content)
  1. It creates the alert with proper fields and values but it also throws a below-given error.
UnicodeDecodeError: don't know how to handle UnicodeDecodeError in error callback

Expected behavior
Alert should be created without throwing an error.

Splunk (please complete the following information):

  • Version: [e.g. 9.1.0.2]
  • OS: [e.g. centos 7.9.2009]
  • Deployment: [e.g. cluster]

SDK (please complete the following information):

  • Version: [e.g. 1.7.3]
  • Language Runtime Version: [e.g. Python 3.11]
  • OS: [e.g. MacOS 13.6]

Additional context
I have backtracked the functions where it is throwing error from
So far I found that _load_atom in https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/client.py#L205C5-L205C15 is throwing the error.

@ashah-splunk
Copy link
Contributor

Hi @faizanmansuri , we are unable to reproduce the issue. So can you please share other details such as Cluster configurations, as well as the response body that is received from the Splunk Enterprise.
Also could you confirm if the issue exists only for the saved-search APIs or all the other APIs as well.
Thanks!

@faizanmansuri
Copy link
Author

Hi @ashah-splunk, Thanks for looking into it.
I found that there is an issue with other APIs response as well in our specific Splunk environment So I don't think it is a SDK problem.

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

2 participants