Splunk Search

Why are we receiving asyncio.TimeoutError while setting up 'Splunk Add-on for Salesforce Streaming API'?

harshal_chakran
Builder

Hi
I am trying to onboard the streaming events from Salesforce into my Splunk and trying to use the 'Splunk Add-on for Salesforce Streaming API' for same.
I have an http proxy at instance level to allow the connect to the internet facing Salesforce Sandbox Instance.

After setting up the required connection and inputs, the data is not getting onboarded. And I am getting following ERROR messages at ta_sfdc_streaming_api_sfdc_streaming_api_events.log

My Splunk Version : 8.1.5

How to solve this?'

##################
ERROR pid=434886 tid=MainThread file=base_modinput.py:log_error:309 | Get error when collecting events.
Traceback (most recent call last):
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/modinput_wrapper/base_modinput.py", line 128, in stream_events
self.collect_events(ew)
File "/opt/splunk/current/etc/apps/TA-sfdc-streaming-api/bin/sfdc_streaming_api_events.py", line 66, in collect_events
input_module.collect_events(self, ew)
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/input_module_sfdc_streaming_api_events.py", line 26, in collect_events
loop.run_until_complete(task)
File "/opt/splunk/current/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/input_module_sfdc_streaming_api_events.py", line 61, in connect_sfdc
async with sf_streaming_client as client:
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiosfstream/exceptions.py", line 143, in async_wrapper
return await func(*args, **kwargs)
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiosfstream/client.py", line 246, in __aenter__
return cast("Client", await super().__aenter__())
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiocometd/client.py", line 432, in __aenter__
await self.open()
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiosfstream/exceptions.py", line 143, in async_wrapper
return await func(*args, **kwargs)
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiosfstream/client.py", line 143, in open
await authenticator.authenticate()
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiosfstream/auth.py", line 100, in authenticate
status_code, response_data = await self._authenticate()
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiosfstream/auth.py", line 187, in _authenticate
response = await session.post(self._token_url, data=data)
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiohttp/client.py", line 619, in _request
break
File "/opt/splunk/etc/apps/TA-sfdc-streaming-api/bin/../lib/aiohttp/helpers.py", line 656, in __exit__
raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
Labels (1)
0 Karma

mik3y
Path Finder

@harshal_chakran @suresh401 

 

One of our salesforce security guys found a workaround that involves modifying a few python scripts under the lib folder.

There are two methods, long polling and web sockets. Long polling was applicable to us so we just fixed that.

Some information on the usage of proxy settings in aiohttp can be found here:

Advanced Client Usage — aiohttp 3.9.3 documentation

The fixes can be applied to the TA-sfdc-streaming-api pack and below is what we modified to successfully subscribe via a proxy.

 

1. Modify /opt/splunk/etc/apps/TA-sfdc-streaming-api/lib/aiocometd/transports/long_polling.py

search for one instance of "session.post" and add  ,proxy="http://<proxyip>:<port>"

long_polling.png

2. Modify /opt/splunk/etc/apps/TA-sfdc-streaming-api/lib/aiosfstream/auth.py

search for two instances of "session.post" and add ,proxy="http://<proxyip>:<port>"

auth.png

 

 

Hope this helps!

 

suresh401
Engager

I am on the same boat. Any update on above request

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...