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

Invalid Endpoint when try to run boto3 client with custom SQS hostname with _ #4283

Closed
1 task
webjoaoneto opened this issue Sep 28, 2024 · 2 comments
Closed
1 task
Assignees
Labels
bug This issue is a confirmed bug. duplicate This issue is a duplicate. needs-triage This issue or PR still needs to be triaged.

Comments

@webjoaoneto
Copy link

webjoaoneto commented Sep 28, 2024

Describe the bug

To reproduce:

import boto3

queue_url = "http://reports_locals:9324/000000000000/account-configs-dev"
queue_region = "us-east-2"

sqs_client = boto3.client("sqs", endpoint_url=queue_url, region_name=queue_region)

When url has "_" characters boto check raises:

    raise ValueError(f"Invalid endpoint: {endpoint_url}")

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

do not raise any execption

Current Behavior

raises an execption with invalid url

Reproduction Steps

import boto3

queue_url = "http://reports-locals:9324/000000000000/account-configs-dev"
queue_region = "us-east-2"

sqs_client = boto3.client("sqs", endpoint_url=queue_url, region_name=queue_region)

Possible Solution

rewrite the url validation regex to allow these patterns with _

Workaround to avoid problems:

import socket

#
# replace the URL to the ip address
# these solution might not working depending of your environment
#
def replace_domain_name_to_ip(full_url):
    domain_name_part = full_url.split("//")[1].split(":")[0]
    domain_name_ip = socket.gethostbyname(domain_name_part)
    return full_url.replace(domain_name_part, domain_name_ip)

Additional Information/Context

No response

SDK version used

1.35.14

Environment details (OS name and version, etc.)

Linux Docker Alpine

@webjoaoneto webjoaoneto added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2024
@tim-finnigan tim-finnigan self-assigned this Sep 30, 2024
@tim-finnigan
Copy link
Contributor

Endpoints containing underscores are currently treated as invalid regardless of the service. This issue is being tracked here: boto/botocore#2426. Please 👍 that issue and share your use case there to help us with prioritization.

@tim-finnigan tim-finnigan closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2024
@tim-finnigan tim-finnigan added the duplicate This issue is a duplicate. label Sep 30, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. duplicate This issue is a duplicate. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants