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

EndpointDiscoveryRefreshFailed: Endpoint Discovery failed to refresh the required endpoints. while using timstream api #2762

Closed
sanjivjha opened this issue Apr 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@sanjivjha
Copy link

Describe the bug

creating database
r.timestream.create_database(database_name)
wr.timestream.create_table(database_name, table_name, memory_retention_hours=1, magnetic_retention_days=1)

but it is throwing the exception


EndpointDiscoveryRefreshFailed Traceback (most recent call last)
Cell In[18], line 7
4 boto3.setup_default_session(region_name=region)
5 client = boto3.client('timestream-influxdb')
----> 7 wr.timestream.create_database(database_name)
8 wr.timestream.create_table(database_name, table_name, memory_retention_hours=1, magnetic_retention_days=1)

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/awswrangler/timestream/_create.py:63, in create_database(database, kms_key_id, tags, boto3_session)
61 if tags is not None:
62 args["Tags"] = [{"Key": k, "Value": v} for k, v in tags.items()]
---> 63 response = client.create_database(**args)
64 return response["Database"]["Arn"]

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/client.py:565, in ClientCreator._create_api_method.._api_call(self, *args, **kwargs)
561 raise TypeError(
562 f"{py_operation_name}() only accepts keyword arguments."
563 )
564 # The "self" in this scope is referring to the BaseClient.
--> 565 return self._make_api_call(operation_name, kwargs)

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/client.py:1001, in BaseClient._make_api_call(self, operation_name, api_params)
997 maybe_compress_request(
998 self.meta.config, request_dict, operation_model
999 )
1000 apply_request_checksum(request_dict)
-> 1001 http, parsed_response = self._make_request(
1002 operation_model, request_dict, request_context
1003 )
1005 self.meta.events.emit(
1006 'after-call.{service_id}.{operation_name}'.format(
1007 service_id=service_id, operation_name=operation_name
(...)
1012 context=request_context,
1013 )
1015 if http.status_code >= 300:

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/client.py:1027, in BaseClient._make_request(self, operation_model, request_dict, request_context)
1025 def _make_request(self, operation_model, request_dict, request_context):
1026 try:
-> 1027 return self._endpoint.make_request(operation_model, request_dict)
1028 except Exception as e:
1029 self.meta.events.emit(
1030 'after-call-error.{service_id}.{operation_name}'.format(
1031 service_id=self._service_model.service_id.hyphenize(),
(...)
1035 context=request_context,
1036 )

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/endpoint.py:119, in Endpoint.make_request(self, operation_model, request_dict)
113 def make_request(self, operation_model, request_dict):
114 logger.debug(
115 "Making request for %s with params: %s",
116 operation_model,
117 request_dict,
118 )
--> 119 return self._send_request(request_dict, operation_model)

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/endpoint.py:198, in Endpoint._send_request(self, request_dict, operation_model)
196 context = request_dict['context']
197 self._update_retries_context(context, attempts)
--> 198 request = self.create_request(request_dict, operation_model)
199 success_response, exception = self._get_response(
200 request, operation_model, context
201 )
202 while self._needs_retry(
203 attempts,
204 operation_model,
(...)
207 exception,
208 ):

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/endpoint.py:134, in Endpoint.create_request(self, params, operation_model)
130 service_id = operation_model.service_model.service_id.hyphenize()
131 event_name = 'request-created.{service_id}.{op_name}'.format(
132 service_id=service_id, op_name=operation_model.name
133 )
--> 134 self._event_emitter.emit(
135 event_name,
136 request=request,
137 operation_name=operation_model.name,
138 )
139 prepared_request = self.prepare_request(request)
140 return prepared_request

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/hooks.py:412, in EventAliaser.emit(self, event_name, **kwargs)
410 def emit(self, event_name, **kwargs):
411 aliased_event_name = self._alias_event_name(event_name)
--> 412 return self._emitter.emit(aliased_event_name, **kwargs)

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/hooks.py:256, in HierarchicalEmitter.emit(self, event_name, **kwargs)
245 def emit(self, event_name, **kwargs):
246 """
247 Emit an event by name with arguments passed as keyword args.
248
(...)
254 handlers.
255 """
--> 256 return self._emit(event_name, kwargs)

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/hooks.py:239, in HierarchicalEmitter._emit(self, event_name, kwargs, stop_on_response)
237 for handler in handlers_to_call:
238 logger.debug('Event %s: calling handler %s', event_name, handler)
--> 239 response = handler(**kwargs)
240 responses.append((handler, response))
241 if stop_on_response and response is not None:

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/discovery.py:250, in EndpointDiscoveryHandler.discover_endpoint(self, request, operation_name, **kwargs)
248 if ids is None:
249 return
--> 250 endpoint = self._manager.describe_endpoint(
251 Operation=operation_name, Identifiers=ids
252 )
253 if endpoint is None:
254 logger.debug('Failed to discover and inject endpoint')

File ~/anaconda3/envs/seglidar/lib/python3.9/site-packages/botocore/discovery.py:220, in EndpointDiscoveryManager.describe_endpoint(self, **kwargs)
218 return self._select_endpoint(endpoints)
219 # No endpoints even refresh, raise hard error
--> 220 raise EndpointDiscoveryRefreshFailed()
221 # Discovery is optional, just use the default endpoint for now
222 return None

EndpointDiscoveryRefreshFailed: Endpoint Discovery failed to refresh the required endpoints.

How to Reproduce

wr.timestream.create_database(database_name)
wr.timestream.create_table(database_name, table_name, memory_retention_hours=1, magnetic_retention_days=1)

Expected behavior

database creation suggess

Your project

No response

Screenshots

No response

OS

macos

Python version

3.12

AWS SDK for pandas version

2.2.1

Additional context

No response

@sanjivjha sanjivjha added the bug Something isn't working label Apr 8, 2024
@jaidisido
Copy link
Contributor

In your code, it seems that you are overriding the default AWS region setting in the underlying boto3 configuration:

boto3.setup_default_session(region_name=region)

This might create a mismatch with the endpoint discovery in Timestream like in this case

@sanjivjha
Copy link
Author

It seems to work fine on other region so I was overriding the region. Related question whether awswrangler support timestream influxDB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants