Comments (5)
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.
from localstack.
Hello @TheBlueSky and thanks a lot for your report!
In order to investigate this issue further, could you please start LocalStack with LS_LOG=trace
, run the sample and share the logs here? We will have more informations about the region and the requests. Thank you!
from localstack.
Hi @bentsku,
I need started LocalStack without -d
flag, and here is what it logged to the terminal:
2024-03-15T11:46:40.276 DEBUG --- [ asgi_gw_0] rolo.gateway.wsgi : POST localhost:4566/
2024-03-15T11:46:40.279 DEBUG --- [ asgi_gw_0] l.aws.protocol.serializer : No accept header given. Using request's Content-Type (application/x-www-form-urlencoded; charset=utf-8) as preferred response Content-Type.
2024-03-15T11:46:40.279 INFO --- [ asgi_gw_0] localstack.request.aws : AWS sns.CreateTopic => 200; 000000000000/us-east-1; CreateTopicInput({'Name': 'another-test-topic'}, headers={'User-Agent': 'aws-sdk-dotnet-coreclr/3.7.301.4 ua/2.0 os/windows#10.0.19045.0 md/ARCH#X64 lang/.NET_Core#6.0.28 md/aws-sdk-dotnet-core#3.7.302.17 api/SNS#3.7.301.4 cfg/retry-mode#legacy md/ClientAsync', 'amz-sdk-invocation-id': '3878e8b1-42ad-4932-bbc8-2d40422f8120', 'amz-sdk-request': 'attempt=1; max=5', 'Host': 'localhost:4566', 'X-Amz-Date': '20240315T114638Z', 'X-Amz-Content-SHA256': '90ac42740a33d8b8b2371ba9384a4762369644160721e0df6057f02d7965dce6', 'Authorization': 'AWS4-HMAC-SHA256 Credential=test/20240315/us-east-1/sns/aws4_request, SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=566b7528c30387fc48ba99d10d0214cebdeb100735d12c8dde7d2743dcaa8784', 'Content-Length': '61', 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'x-moto-account-id': '000000000000'}); CreateTopicResponse({'TopicArn': 'arn:aws:sns:us-east-1:000000000000:another-test-topic'}, headers={'Content-Type': 'text/xml', 'Content-Length': '340'})
2024-03-15T11:46:41.285 DEBUG --- [ asgi_gw_0] rolo.gateway.wsgi : GET localhost.localstack.cloud:4566/_localstack/health
2024-03-15T11:46:42.363 DEBUG --- [ asgi_gw_0] rolo.gateway.wsgi : POST localhost:4566/
2024-03-15T11:46:42.365 DEBUG --- [ asgi_gw_0] l.aws.protocol.serializer : No accept header given. Using request's Content-Type (application/x-www-form-urlencoded; charset=utf-8) as preferred response Content-Type.
2024-03-15T11:46:42.366 INFO --- [ asgi_gw_0] localstack.request.aws : AWS sns.Publish => 400 (InvalidParameter); 000000000000/us-east-1; PublishInput({'TopicArn': 'arn:aws:sns:eu-west-1:000000000000:one-test-topic', 'Message': 'Hello from .NET!'}, headers={'User-Agent': 'aws-sdk-dotnet-coreclr/3.7.301.4 ua/2.0 os/windows#10.0.19045.0 md/ARCH#X64 lang/.NET_Core#6.0.28 md/aws-sdk-dotnet-core#3.7.302.17 api/SNS#3.7.301.4 cfg/retry-mode#legacy md/ClientAsync', 'amz-sdk-invocation-id': 'a2ffda71-30fc-4628-88ea-38e2bda6d6ad', 'amz-sdk-request': 'attempt=1; max=5', 'Host': 'localhost:4566', 'X-Amz-Date': '20240315T114640Z', 'X-Amz-Content-SHA256': 'f6520d733a5843b386707fdb056bf40eb44beb32271240c1a814d45c39f555ab', 'Authorization': 'AWS4-HMAC-SHA256 Credential=test/20240315/us-east-1/sns/aws4_request, SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=417e39311133c28e5fc137178e810eda0a0ccb9020e652ae56334d9f920ca235', 'Content-Length': '133', 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'x-moto-account-id': '000000000000'}); InvalidParameter(Invalid parameter: TopicArn, headers={'Content-Type': 'text/xml', 'Content-Length': '287'})
from localstack.
Hello @TheBlueSky, sorry for the delay on this one.
Looking at your logs, it seems your SDK is not properly setting the region here.
Here's the content of your credentials in your Authorization header: Credential=test/20240315/us-east-1/sns/aws4_request
. As you can see, the region there is set to us-east-1
, which is why the request is directed to that region.
I'm not exactly sure why that is, and why it works against AWS and not LocalStack? But LocalStack won't be able to target the correct region if the header sent is wrong.
Looking at our documentation for .NET SDK, it seems the way to set up the region should be a bit different:
https://docs.localstack.cloud/user-guide/integrations/sdks/dotnet/
I believe setting the region endpoint while targeting AWS will automatically set up your authentication region. But as you override the ServiceURL
to another, the automated region detection might not work?
I think this is related to the AuthenticationRegion
in the config.
Maybe doing the following would solve it?
var options = new AWSOptions
{
Credentials = new BasicAWSCredentials("test", "test"),
Region = Amazon.RegionEndpoint.EUWest1,
};
options.DefaultClientConfig.ServiceURL = "http://localhost:4566";
options.DefaultClientConfig.AuthenticationRegion = "eu-west-1";
Tell me if that does solve the issue for you? Thanks!
from localstack.
Hi @bentsku,
sorry for the delay on this one.
No worries. I appreciate the time and effort that you put into this.
Tell me if that does solve the issue for you?
Yes, setting options.DefaultClientConfig.AuthenticationRegion = "eu-west-1";
solved the issue. Thank you for that, and many thanks for the link to the .NET specific documentation... I did not know it existed๐
from localstack.
Related Issues (20)
- Localstack using CDKlocal sends requests to wrong url for DynamoDB HOT 2
- EventBridge is still called 'Cloud Watch Events' in the resource browser HOT 1
- feature request: Add pg_cron extension for postgres rds HOT 1
- bug: Cannot create an SQS queue with FifoQueue: false HOT 2
- feature request: Adds the ability to accept SQS requests using the AWS JSON protocol within LocalStack.
- feature request: Neptune transaction support HOT 4
- bug: ElastiCache create-replication-group replica will always be created
- bug: ElastiCache: Unable to get ConfigurationEndpoint created by create-replication-group with REDIS_CONTAINER_MODE
- bug: Nested Stack not deleted when parent stack in ROLLBACK_COMPLETE status is deleted
- bug: Typo in main website HOT 1
- bug: hanging during `docker run` with docker v4.30.0 HOT 4
- How to debug an infinite loop? HOT 2
- bug: Presigned URL failed on GET for downloading HOT 3
- bug: TimeStream Characters Limits HOT 1
- bug: TimeStream - ColumnInfo is always null (C#)
- Internal Refactoring: Towards a Multi-Distribution Setup
- bug: Kinesis SubscribeToShard Timeouts with Java KCL Enhanced Fan-Out Consumers HOT 2
- bug: LocalStack Glue Not Working(--exta-jars not found in classpath) HOT 1
- bug: Using IPv6 addresses in GATEWAY_LISTEN causes error HOT 1
- Trying to remtote debug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localstack.