status
stringclasses 1
value | repo_name
stringclasses 13
values | repo_url
stringclasses 13
values | issue_id
int64 1
104k
| updated_files
stringlengths 11
1.76k
| title
stringlengths 4
369
| body
stringlengths 0
254k
⌀ | issue_url
stringlengths 38
55
| pull_url
stringlengths 38
53
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[ns, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | localstack/localstack | https://github.com/localstack/localstack | 6,620 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | Unable to create fifo queue with new release 1.0.4. | In release 1.0.4, I can no longer create a fifo queue by setting the attribute FifoQueue=true.
I believe it is due to this code from this issue: https://github.com/localstack/localstack/pull/6117/files
FifoQueue was set as an internal attribute which cannot be changed:
(snip from PR)
INTERNAL_QUEUE_ATTRIBUTES = [
# these attributes cannot be changed by set_queue_attributes and should
# therefore be ignored when comparing queue attributes for create_queue
QueueAttributeName.ApproximateNumberOfMessages,
QueueAttributeName.ApproximateNumberOfMessagesDelayed,
QueueAttributeName.ApproximateNumberOfMessagesNotVisible,
QueueAttributeName.ContentBasedDeduplication,
QueueAttributeName.CreatedTimestamp,
**QueueAttributeName.FifoQueue,**
QueueAttributeName.LastModifiedTimestamp,
QueueAttributeName.QueueArn,
]
Now I see this error when attempting to create a fifo queue with the java sdk. This worked last week fine, no changes other than pulling the latest localstack image.
nested exception is com.amazonaws.services.sqs.model.InvalidAttributeNameException: Unknown Attribute FifoQueue. | https://github.com/localstack/localstack/issues/6620 | https://github.com/localstack/localstack/pull/6622 | bda98e1ee5591d23f3245984bc6a57c645531a49 | c076fe8d9280786edac393d95fd2b57ab4b2c4e7 | 2022-08-08T23:29:27Z | python | 2022-08-09T10:19:15Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,613 | ["localstack/services/awslambda/lambda_api.py", "localstack/services/sns/provider.py", "localstack/utils/aws/dead_letter_queue.py", "tests/integration/awslambda/test_lambda_sqs_integration.py", "tests/integration/awslambda/test_lambda_sqs_integration.snapshot.json", "tests/integration/test_sns.py"] | bug: format of message when using SNS Topic as a Lambda DLQ | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
The format of the message received when using an SNS topic as a lambda DLQ diverges from AWS'.
What is missing is the whole event as received by the lambda to be passed as the `Message` field of the SNS message, and not only the `Message` sent to the lambda.
Current response from Localstack using snapshot mechanism:
```json
{
"Body": {
"Message": {
"raise_error": 1
},
"MessageAttributes": {
"ErrorCode": {
"Type": "String",
"Value": "200"
},
"ErrorMessage": {
"Type": "String",
"Value": "Lambda process returned with error. Result: {\"errorType\":\"Exception\",\"errorMessage\":\"Test exception (this is intentional)\",\"stackTrace\":[\" File \\\"/var/task/handler.py\\\", line 126, in handler\\n raise Exception(\\\"Test exception (this is intentional)\\\")\\n\"]}. Output:\n[32mSTART RequestId: 0bf50aba-256b-11b8-8e3a-93690a4d8bcc Version: $LATEST[0m\nLambda log message - print function\n[INFO]\t2022-08-08T13:36:16.615Z\t0bf50aba-256b-11b8-8e3a-93690a4d8bcc\tLambda log message - logging module\n\n[ERROR] Exception: Test exception (this is intentional)\nTraceback (most recent call last):\n\u00a0\u00a0File \"/var/task/handler.py\", line 126, in handler\n\u00a0\u00a0\u00a0\u00a0raise Exception(\"Test exception (this is intentional)\")\n[32mEND RequestId: 0bf50aba-256b-11b8-8e3a-93690a4d8bcc[0m\n[32mREPORT RequestId: 0bf50aba-256b-11b8-8e3a-93690a4d8bcc\tInit Duration: 361.22 ms\tDuration: 6.06 ms\tBilled Duration: 7 ms\tMemory Size: 1536 MB\tMax Memory Used: 35 MB\t[0m"
},
"RequestID": {
"Type": "String",
"Value": "<request-id:1>"
}
},
"MessageId": "<uuid:1>",
"Signature": "<signature>",
"SignatureVersion": "1",
"SigningCertURL": "https://sns.<region>.amazonaws.com/SimpleNotificationService-<signing-cert-file:1>",
"Timestamp": "date",
"TopicArn": "arn:aws:sns:<region>:111111111111:<resource:1>",
"Type": "Notification",
"UnsubscribeURL": "<unsubscribe-domain>/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:<region>:111111111111:<resource:1>:<resource:2>"
},
"MD5OfBody": "<md5-hash>",
"MessageId": "<uuid:2>",
"ReceiptHandle": "<receipt-handle:1>"
}
```
### Expected Behavior
Example message from AWS using the snapshot mechanism:
```json
{
"Body": {
"Message": {
"Records": [
{
"EventSource": "aws:sns",
"EventSubscriptionArn": "arn:aws:sns:<region>:111111111111:<resource:4>:<resource:1>",
"EventVersion": "1.0",
"Sns": {
"Message": {
"raise_error": 1
},
"MessageAttributes": {},
"MessageId": "<uuid:1>",
"Signature": "<signature>",
"SignatureVersion": "1",
"SigningCertUrl": "https://sns.<region>.amazonaws.com/SimpleNotificationService-<signing-cert-file:1>",
"Subject": null,
"Timestamp": "date",
"TopicArn": "arn:aws:sns:<region>:111111111111:<resource:4>",
"Type": "Notification",
"UnsubscribeUrl": "<unsubscribe-domain>/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:<region>:111111111111:<resource:4>:<resource:1>"
}
}
]
},
"MessageAttributes": {
"ErrorCode": {
"Type": "Number",
"Value": "200"
},
"ErrorMessage": {
"Type": "String",
"Value": "Test exception (this is intentional)"
},
"RequestID": {
"Type": "String",
"Value": "<request-id:1>"
}
},
"MessageId": "<uuid:2>",
"Signature": "<signature>",
"SignatureVersion": "1",
"SigningCertURL": "https://sns.<region>.amazonaws.com/SimpleNotificationService-<signing-cert-file:1>",
"Timestamp": "date",
"TopicArn": "arn:aws:sns:<region>:111111111111:<resource:3>",
"Type": "Notification",
"UnsubscribeURL": "<unsubscribe-domain>/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:<region>:111111111111:<resource:3>:<resource:2>"
},
"MD5OfBody": "<md5-hash>",
"MessageId": "<uuid:3>",
"ReceiptHandle": "<receipt-handle:1>"
}
```
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
Run the SNS test `tests.integration.test_sns.TestSNSProvider.test_sns_topic_as_lambda_dead_letter_queue`, the scenario is already reproduced.
### Environment
```markdown
- OS: macOS Monterey 12.5
- LocalStack: latest (1.0.4dev)
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6613 | https://github.com/localstack/localstack/pull/6625 | 99557cfc4771348e15fd5c2e73102eb237bd2286 | 9e00807d82b74a094cb54f42b06e515104a7eb5b | 2022-08-08T15:21:37Z | python | 2022-08-11T19:31:31Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,612 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | bug: SQS SendMessage InvalidParameterValue DelaySeconds 0 | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I have an application which uses SQS.
It works in production.
It has acceptance tests which were passing with localstack until very recently.
Now I see:
```
An error occurred (InvalidParameterValue) when calling the SendMessage operation: Value 0 for parameter DelaySeconds is invalid. Reason: The request include parameter that is not valid for this queue type.
```
Yes, delay `0` is being passed in to `send_message` but this used to work in both localstack and AWS.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html#SQS.Client.send_message
> DelaySeconds (integer) --
The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900.
### Expected Behavior
DelaySeconds 0 is a valid value.
sqs send_message works when explicitly setting delay 0.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run localstack/localstack
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
1. Create a SQS FIFO queue.
2. Try to `send_message`, specifying `DelaySeconds=0`
### Environment
```markdown
- OS: macos
- LocalStack: latest
```
### Anything else?
I notice on a recent issue that @thrau said he recently changed how SQS attribute values are validated. | https://github.com/localstack/localstack/issues/6612 | https://github.com/localstack/localstack/pull/6633 | 8f157e56ba9808945e445950b749a3a58d6e953f | ccdddb3d19dc256e0138894de431265a91a2c0f7 | 2022-08-08T14:23:00Z | python | 2022-08-10T20:06:13Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,567 | ["localstack/services/awslambda/lambda_api.py", "localstack/services/awslambda/lambda_executors.py", "localstack/services/awslambda/lambda_utils.py", "localstack/utils/aws/aws_models.py", "tests/unit/test_lambda.py"] | bug: Lambda initialization slow on Docker Desktop bind volumes | ## Problem
Currently, even if `LAMBDA_REMOTE_DOCKER=1`, we unzip the zip files in the directory they are in, which is usually /var/lib/localstack, which usually has a bind mount to the host.
On docker desktop, due to the use of grpc-FUSE (on macos), this can be very slow, about 200 times slower than on volumes / directly on the host. With experimental virtio filesystem enabled (also on macos), this can be reduced to about 30 times as slow, but still problematic.
This means a lambda may take a lot of time processing, for each additional layer some more. This especially affects nodejs lambdas with huge node_modules folders.
## Probable solution
At least if `LAMBDA_REMOTE_DOCKER=1`, we should leave the initial zip files on the bind mount (for persistence etc), but the working directories after unzipping should be located on non-bind mounts, to speed up the IO for unzipping. | https://github.com/localstack/localstack/issues/6567 | https://github.com/localstack/localstack/pull/6595 | 3f7a7fe727e99860e80fd8c12e33656086e8925d | e269ebf7dab39ed67385023f891114728a50eae6 | 2022-08-01T09:34:38Z | python | 2022-08-09T13:30:44Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,566 | ["localstack/services/awslambda/lambda_api.py", "localstack/utils/aws/aws_models.py", "tests/integration/awslambda/test_lambda.py", "tests/integration/awslambda/test_lambda.snapshot.json", "tests/integration/awslambda/test_lambda_size_lims.py", "tests/integration/awslambda/test_lambda_whitebox.py", "tests/unit/test_lambda.py"] | bug: Lambda state does not reflect internal state | While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).
Lambda state should reflect the current internal state, and invocations should fail if not active. | https://github.com/localstack/localstack/issues/6566 | https://github.com/localstack/localstack/pull/6575 | c341336dbf5ab9c89d54509f68bcd2e4dca5ce4b | a364f14e880a8f66a5ee9d1ee5b34ca5f3ac409b | 2022-08-01T09:28:36Z | python | 2022-08-03T12:36:46Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,553 | ["localstack/services/s3/s3_listener.py", "tests/integration/s3/test_s3.py"] | bug: S3 internalError when try to get an object which was deleted before instead of error code NoSuchKey | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
We have some tests which are creating and deleting objects at s3. This tests are failing with localstack version 0.14.4 and newer.
Because of an internalError we get as error null instead of NoSuchKey as error code.
Logs of localstack:
```
2022-07-29T14:44:55.319 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: 'FakeDeleteMarker' object has no attribute '_expiry'
2022-07-29T14:44:55.325 INFO --- [ asgi_gw_0] localstack.request.aws : AWS s3.GetObject => 500 (InternalError)
2022-07-29T14:44:55.463 ERROR --- [ asgi_gw_1] l.aws.handlers.logging : exception during call chain: 'FakeDeleteMarker' object has no attribute '_expiry'
2022-07-29T14:44:55.464 INFO --- [ asgi_gw_1] localstack.request.aws : AWS s3.GetObject => 500 (InternalError)
2022-07-29T14:44:57.444 ERROR --- [ asgi_gw_1] l.aws.handlers.logging : exception during call chain: 'FakeDeleteMarker' object has no attribute '_expiry'
2022-07-29T14:44:57.445 INFO --- [ asgi_gw_1] localstack.request.aws : AWS s3.GetObject => 500 (InternalError)
2022-07-29T14:45:00.403 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: 'FakeDeleteMarker' object has no attribute '_expiry'
2022-07-29T14:45:00.404 INFO --- [ asgi_gw_0] localstack.request.aws : AWS s3.GetObject => 500 (InternalError)
2022-07-29T14:45:06.976 ERROR --- [ asgi_gw_1] l.aws.handlers.logging : exception during call chain: 'FakeDeleteMarker' object has no attribute '_expiry'
2022-07-29T14:45:06.977 INFO --- [ asgi_gw_1] localstack.request.aws : AWS s3.GetObject => 500 (InternalError)
An error occurred (InternalError) when calling the GetObject operation (reached max retries: 4): exception while calling s3.GetObject: 'FakeDeleteMarker' object has no attribute '_expiry'
```
### Expected Behavior
We would expect to get an error code NoSuchKey instead of null.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-conpose.yml:
> version: '3.5'
> services:
> localstack:
> image: localstack/localstack:1.0.2
> volumes:
> - ./localstack/init-localstack.sh:/docker-entrypoint-initaws.d/init-localstack.sh
> environment:
> - DEFAULT_REGION=eu-central-1
> - SERVICES=s3
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
init-localstack.sh:
```
awslocal s3api create-bucket --bucket test-bucket --create-bucket-configuration LocationConstraint=eu-central-1
awslocal s3api put-object --bucket test-bucket --key test.json
awslocal s3api get-object --bucket test-bucket --key test.json test.json
awslocal s3api delete-object --bucket test-bucket --key test.json
awslocal s3api get-object --bucket test-bucket --key test.json test.json
```
### Environment
```markdown
- OS: Ubuntu 20.04
- LocalStack: 1.0.2
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6553 | https://github.com/localstack/localstack/pull/7246 | edbfece1bd332b8d3f5f5af35028f8d0785836f4 | c91c1660f9ae876be2cebdae144d471e27e88d51 | 2022-07-29T15:07:45Z | python | 2022-11-29T13:54:05Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,544 | ["localstack/aws/protocol/parser.py", "localstack/aws/protocol/serializer.py", "localstack/services/s3/s3_listener.py", "tests/unit/aws/protocol/test_serializer.py"] | bug: Incorrect error response from get-object | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Localstack (1.0.2) returns what appears to be an incorrect error response when calling `get-object` against a non-existent bucket:
```
$ awslocal --debug s3api get-object --bucket=not-exists-2341234 --key=doesnt-matter.txt doesnt-matter.txt 2>&1 | grep Error | uniq
b"<?xml version='1.0' encoding='utf-8'?>\n<ErrorResponse><Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><Type>Sender</Type></Error><RequestId>3FA3WN14HJTCNKT0TFF6LIKTAUQ0XO3AB7MUCIQAIW8KST6T0BA1</RequestId></ErrorResponse>"
```
```
$ aws --debug s3api get-object --bucket=not-exists-2341234 --key=doesnt-matter.txt doesnt-matter.txt 2>&1 | grep Error | uniq
b'<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><BucketName>not-exists-2341234</BucketName><RequestId>99NA328HYHDQH2VN</RequestId><HostId>Kp5IOfCoHrw8Hvo8VL+f994yByXJGECQ4Fy5eNoY/7MPpMcHz2QygoG23ILrmF1TkiYoR+k2Njg=</HostId></Error>'
```
Pretty-printing the XML makes the difference in behaviour clearer:
```xml
<ErrorResponse>
<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<Type>Sender</Type>
</Error>.
<RequestId>3FA3WN14HJTCNKT0TFF6LIKTAUQ0XO3AB7MUCIQAIW8KST6T0BA1</RequestId>
</ErrorResponse>
```
vs
```xml
<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>not-exists-2341234</BucketName>
<RequestId>99NA328HYHDQH2VN</RequestId>.
<HostId>Kp5IOfCoHrw8Hvo8VL+f994yByXJGECQ4Fy5eNoY/7MPpMcHz2QygoG23ILrmF1TkiYoR+k2Njg=</HostId>
</Error>
```
I've also observed the same behaviour when calling the `get-object` API from the Rust SDK.
The problem does not appear prior to version `1.0.0`.
### Expected Behavior
The returned error should have the format described in the spec:
https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run -p 4566:4566 localstack/localstack:1.0.2
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal --debug s3api get-object --bucket=not-exists-2341234 --key=doesnt-matter.txt doesnt-matter.txt 2>&1 | grep Error | uniq
### Environment
```markdown
- OS: OSX
- LocalStack: 1.0.2
```
### Anything else?
The same behaviour is observed on `1.0.0`. Reverting to `0.14.5` we see:
```xml
<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName></BucketName>
<RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>
</Error>
```
which is the correct behaviour. | https://github.com/localstack/localstack/issues/6544 | https://github.com/localstack/localstack/pull/6548 | 20f964dc060826434e752b1c1cfc1b90b7f897df | 42abace469fa57ecad6733170be874b4c1e3160b | 2022-07-29T07:26:55Z | python | 2022-07-29T13:15:21Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,532 | ["localstack/services/apigateway/helpers.py", "localstack/services/apigateway/provider.py", "localstack/testing/snapshots/transformer_utility.py", "tests/integration/awslambda/functions/lambda_aws_proxy.py", "tests/integration/test_apigateway_integrations.py", "tests/integration/test_apigateway_integrations.snapshot.json"] | path being passed into event missing trailing slash | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
event path doesn't have trailing slash
### Expected Behavior
event path should have trailing slash
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
{**'path': '/get_presigned_url'**, 'headers': {'Host': '0vcomlwzdi.execute-api.localhost.localstack.cloud:4566', .... more event logs .... }
### Environment
```markdown
- OS: Mac m1
- LocalStack: 1.0.1
```
### Anything else?
noticing this while running a lambda test against localstack...in AWS the trailing slash in present | https://github.com/localstack/localstack/issues/6532 | https://github.com/localstack/localstack/pull/6647 | a7014a8a16520af74daf088e0b80a3810e847c6d | 013752a8720723e3123ea34f66683fe89e3933ae | 2022-07-27T20:25:40Z | python | 2022-09-08T11:29:10Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,528 | ["localstack/aws/client.py", "localstack/aws/protocol/serializer.py", "tests/unit/aws/protocol/test_serializer.py", "tests/unit/aws/test_client.py"] | bug: Describe Subnets Response Diverges from AWS | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
In AWS, DescribeSubnet Response returns:
```
<?xml version="1.0" encoding="UTF-8"?>\n
<Response>
<Errors>
<Error>
<Code>InvalidSubnetID.NotFound</Code>
<Message>The subnet ID \'test\' does not exist</Message>
</Error>
</Errors>
<RequestID>f6d041c1-1c96-4720-af30-77745504e2ba</RequestID>
</Response>
```
whereas localstack returns:
```
<?xml version=\'1.0\' encoding=\'utf-8\'?>\n<Errors xmlns="http://ec2.amazonaws.com/doc/2016-11-15">
<Error>
<Code>InvalidSubnetID.NotFound</Code>
<Message>aaThe subnet ID \'vpc-test\' does not exist</Message>
</Error>
<RequestID>EADJHWMM796CI5FT10XGFMGOXIPCBAHBWINMV0HR6SKBRODGCU5J</RequestID>
</Errors>
```
### Expected Behavior
It should return correct response structure. It causes terraform to complain.
### How are you starting LocalStack?
Custom (please describe below)
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
make start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal ec2 describe-subnets --subnet-ids vpc-test --debug
### Environment
```markdown
- OS: M1 MacOS
- LocalStack: 1.0.2.dev
```
### Anything else?
Probably `call_moto` function in `localstack/services/moto.py` is changing the error code structure. | https://github.com/localstack/localstack/issues/6528 | https://github.com/localstack/localstack/pull/6535 | c1c582ec727ff03cc3b67507a36efd42e94c8ffc | b68805b7fa8cd99af0eb663a551908f0996a8a6b | 2022-07-27T17:12:43Z | python | 2022-07-28T10:19:25Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,495 | ["localstack/utils/aws/aws_responses.py", "tests/unit/utils/aws/test_aws_responses.py"] | bug: Responses contain mixed-case boolean values | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I'm using [Localstack with the Rust SDK](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/localstack.html), and it is reporting an error parsing the `RunInstancesResponse` type:
```
Error: Error parsing XML: expected (boolean: `com.amazonaws.ec2#Boolean`)
Caused by:
0: Error parsing XML: expected (boolean: `com.amazonaws.ec2#Boolean`)
1: Error parsing XML: expected (boolean: `com.amazonaws.ec2#Boolean`)
```
The response contains this:
```
<ebsOptimized>False</ebsOptimized>
```
which does not conform to the API reference's description of [AttributeBooleanValue](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_AttributeBooleanValue.html), which says that the valid values are `true` or `false`.
### Expected Behavior
The API should return boolean values in lowercase as specified by the Amazon API Reference.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```yaml
version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack
network_mode: bridge
ports:
- "127.0.0.1:4510-4559:4510-4559" # external service port range
- "127.0.0.1:4566:4566" # LocalStack Edge Proxy
environment:
- DEBUG=${DEBUG-}
- DATA_DIR=${DATA_DIR-}
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-}
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "${DOCKER_SOCK:-/var/run/docker.sock}:/var/run/docker.sock"
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```rust
let ec2: aws_sdk_ec2::Client = ...;
let resp = ec2
.run_instances()
.image_id(image_id)
.max_count(1)
.min_count(1)
.key_name(key_name)
.security_group_ids(gid)
.subnet_id(sid)
.send()
.await?;
```
### Environment
```markdown
- OS: Ubuntu 18.04 LTS
- LocalStack:
localstack_main | LocalStack version: 1.0.2.dev
localstack_main | LocalStack Docker container id: 73a491727a3c
localstack_main | LocalStack build date: 2022-07-20
localstack_main | LocalStack build git hash: e105e488
```
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6495 | https://github.com/localstack/localstack/pull/6525 | c55c5deebbb59d178a543dde2811b59006c678f2 | 20f964dc060826434e752b1c1cfc1b90b7f897df | 2022-07-21T15:28:28Z | python | 2022-07-29T09:35:48Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,462 | ["localstack/services/apigateway/integration.py", "localstack/services/apigateway/invocations.py", "localstack/services/apigateway/patches.py", "localstack/services/apigateway/provider.py", "tests/integration/apigateway_fixtures.py", "tests/integration/awslambda/functions/lambda_aws_proxy.py", "tests/integration/awslambda/test_lambda.py", "tests/integration/test_apigateway.py", "tests/integration/test_apigateway_api.py"] | bug: API Gateway Method Integration's Request Template modifies event incorrectly | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I have the following resource in my CloudFormation template which creates an API Gateway Method with and Integration that has a Request Template:
```json
"AppSignUpApiGatewayMethod": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"AuthorizationType": "NONE",
"HttpMethod": "ANY",
"ResourceId": {
"Ref": "AppSignUpApiGatewayResource"
},
"RestApiId": {
"Ref": "AppApiGatewayRestApi"
},
"Integration": {
"IntegrationHttpMethod": "POST",
"Type": "AWS",
"Uri": {
"Fn::Sub": [
"arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations",
{
"lambdaArn": {
"Fn::GetAtt": "AppSignUpLambdaFunction.Arn"
}
}
]
},
"RequestTemplates": {
"application/json": "#set($allParams = $input.params())\n{\n\"body-json\" : $input.json(\"$\"),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n #set($params = $allParams.get($type))\n\"$type\" : {\n #foreach($paramName in $params.keySet())\n \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\n #if($foreach.hasNext),#end\n #end\n}\n #if($foreach.hasNext),#end\n#end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n \"api-id\" : \"$context.apiId\",\n \"api-key\" : \"$context.identity.apiKey\",\n \"http-method\" : \"$context.httpMethod\",\n \"stage\" : \"$context.stage\",\n \"source-ip\" : \"$context.identity.sourceIp\",\n \"user-agent\" : \"$context.identity.userAgent\",\n \"request-id\" : \"$context.requestId\",\n \"resource-id\" : \"$context.resourceId\",\n \"resource-path\" : \"$context.resourcePath\"\n }\n}\n"
},
"IntegrationResponses": [
{
"StatusCode": "200",
"ResponseParameters": {
"method.response.header.Access-Control-Allow-Origin": "'*'",
"method.response.header.Content-Type": "'text/html'"
},
"ResponseTemplates": {
"text/html": "$input.path('$')"
}
}
]
},
"MethodResponses": [
{
"StatusCode": "200",
"ResponseParameters": {
"method.response.header.Access-Control-Allow-Origin": false,
"method.response.header.Content-Type": false
}
}
]
}
},
```
So that it's easier to read the request template is as follows:
```
#set($allParams = $input.params())
{
"body-json" : $input.json("$"),
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
"$paramName" : "$util.escapeJavaScript($params.get($paramName))"
#if($foreach.hasNext),#end
#end
}
#if($foreach.hasNext),#end
#end
},
"stage-variables" : {
#foreach($key in $stageVariables.keySet())
"$key" : "$util.escapeJavaScript($stageVariables.get($key))"
#if($foreach.hasNext),#end
#end
},
"context" : {
"api-id" : "$context.apiId",
"api-key" : "$context.identity.apiKey",
"http-method" : "$context.httpMethod",
"stage" : "$context.stage",
"source-ip" : "$context.identity.sourceIp",
"user-agent" : "$context.identity.userAgent",
"request-id" : "$context.requestId",
"resource-id" : "$context.resourceId",
"resource-path" : "$context.resourcePath"
}
}
```
When I invoke lambda through API Gateway, I expect the `event` argument of the handler function to contain `stage-variables`, `context`, etc. However, I get the following:
```
{
# Some other values removed for brevity
"body": '{\n"body-json" : {},\n"params" : {\n\n "path" : {\n }\n ,\n "querystring" : {}\n ,\n "header" : {\n }\n },\n"stage-variables" : {\n},\n"context" : {\n "api-id" : "4agib5ldvc",\n "api-key" : "",\n "http-method" : "GET",\n "stage" : "STAGE",\n "source-ip" : "172.17.0.1",\n "user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0",\n "request-id" : "ac8c1a09-56a5-4367-ace3-5eabf5510461",\n "resource-id" : "buz8uugung",\n "resource-path" : "/sign-up"\n }\n}\n',
}
```
Everything is inside `event["body"]` as an unparsed JSON string.
### Expected Behavior
When I deploy the same CloudFormation template on AWS, `event` looks like this:
```
{
"body-json": {},
"params": {
"path": {},
"querystring": {},
"header": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.5",
"cache-control": "no-cache",
"CloudFront-Forwarded-Proto": "https",
"CloudFront-Is-Desktop-Viewer": "true",
"CloudFront-Is-Mobile-Viewer": "false",
"CloudFront-Is-SmartTV-Viewer": "false",
"CloudFront-Is-Tablet-Viewer": "false",
"CloudFront-Viewer-ASN": "16342",
"CloudFront-Viewer-Country": "PL",
"Cookie": "__stripe_mid=b6c6f963-d084-4f95-a08b-517e5a4e4916740344; __stripe_sid=b9c4f39e-78b5-4caf-8d8a-86da120a9b2bec82a0; basic_user_qty=1; number_type=toll_free; package=voip_user_tiered; pdc_lead_session_token=3593c55a-4ec3-422c-9da7-64fb3e6df38c; plus_user_qty=0; pro_user_qty=0",
"Host": "ck764avt73.execute-api.us-west-1.amazonaws.com",
"pragma": "no-cache",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0",
"Via": "2.0 3157923491f1e8705fd766b0cf62e414.cloudfront.net (CloudFront)",
"X-Amz-Cf-Id": "tqYimyyEEgmbW6EjuC6duCyflAGWrqaIs6KQD44Lx8pl85yu5pEIVA==",
"X-Amzn-Trace-Id": "Root=1-62d02d39-46a0e37359519e081b807920",
"X-Forwarded-For": "77.237.9.30, 130.176.211.47",
"X-Forwarded-Port": "443",
"X-Forwarded-Proto": "https",
},
},
"stage-variables": {},
"context": {
"api-id": "ck764avt73",
"api-key": "",
"http-method": "GET",
"stage": "STAGE",
"source-ip": "77.237.9.30",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0",
"request-id": "cb341fd4-a781-453c-b91e-999ed040b642",
"resource-id": "721t4i",
"resource-path": "/sign-up",
},
}
```
In other words, in AWS, `event` becomes the parsed version of `event["body"]` from LocalStack.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
This is the config I use for docker compose:
```yaml
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack:1.0.0
network_mode: bridge
ports:
# https://github.com/localstack/localstack/issues/3080#issuecomment-966182047
- "4510-4559:4510-4559" # external service port range
- "4566:4566" # LocalStack Edge Proxy
environment:
- DEBUG=${DEBUG-}
- DATA_DIR=${DATA_DIR-}
- LAMBDA_EXECUTOR=docker-reuse
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
# https://github.com/localstack/localstack/issues/2515
#- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
I use `update_stack` from boto3 to deploy the CloudFormation template. Deploy succeeds.
### Environment
```markdown
- OS: macOS 12.4
- LocalStack: 1.0.0
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6462 | https://github.com/localstack/localstack/pull/6667 | bc127373ffa696d05ffacf2391cf03c113036992 | c422d9ef8c9438ff252423a6b910ddbebb62b81d | 2022-07-15T12:23:49Z | python | 2022-08-23T21:13:43Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,458 | ["localstack/services/awslambda/lambda_executors.py", "localstack/utils/docker_utils.py", "tests/unit/test_lambda.py"] | bug: localstack CLI seems to download old images (slowly!) if `latest` is missing | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I've been having issues with either Docker or Localstack, so a couple of times today I've removed all the images (and eventually reset/reinstalled Docker Desktop which deleted all the images again). I've noticed that when I run `localstack start` (installed with `pip`, on the host macOS) and the `localstack/localstack:latest` image is not present, `localstack` starts downloading a bunch of old images instead of `latest`.
```sh
bash-3.2$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
bash-3.2$ localstack start
# this step will remain silent for as long as you let it
# nothing will happen for several minutes but eventually you'll see bursts of network activity
<Ctrl-C to see a KeyboardInterrupt stack trace>
bash-3.2$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
localstack/localstack 0.10.1.2 9bf25773d5f0 2 years ago 855MB
localstack/localstack 0.10.0 835c5cec4d47 2 years ago 855MB
```
### Expected Behavior
The `localstack` CLI tool sees that `localstack/localstack:latest` does not exist on the local machine, and pulls that version of the image _only_
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```sh
docker image ls
docker image rm localstack/localstack:latest
localstack start
```
### Environment
```markdown
- OS: macOS 12.4, Docker Desktop 4.10, Python 3.9.13 (Homebrew)
- LocalStack:
- `localstack 1.0.0`
- `localstack-client 1.35`
- `localstack-ext 1.0.0`
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6458 | https://github.com/localstack/localstack/pull/6474 | d509cdfbbf96823b0ed1b90db0ef4eaa200870ba | 186c9ddb13f084dcbe3c37c0a98025869fcbb63d | 2022-07-14T14:06:07Z | python | 2022-07-18T16:36:13Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,445 | ["localstack/aws/app.py", "localstack/aws/handlers/__init__.py", "localstack/aws/handlers/legacy.py"] | bug: SQS performance regression with ASF | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Hi, I'm testing the image `localstack/localstack:0.14.5`, and setting `LEGACY_EDGE_PROXY=1` makes the following cleanup code much slower:
`for queue in client.list_queues()['QueueUrls']: client.purge_queue(QueueUrl=queue)`
`LEGACY_EDGE_PROXY=1`: `56.2 ms ± 2.9 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)`
`LEGACY_EDGE_PROXY=0`: `258 ms ± 17.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)`
### Expected Behavior
I expected performance to improve or not to regress.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
# Benchmark setup:
Docker-compose file:
```
version: "3.9"
services:
localstack:
image: localstack/localstack:latest
environment:
- DEFAULT_REGION=eu-west-1
- SERVICES=s3,sns,sqs
- LEGACY_EDGE_PROXY=1 # or 0
ipc: host
```
```
# docker-compose rm -f localstack && docker-compose up localstack
```
```
import boto3
client = boto3.resource(
'sqs',
endpoint_url="http://localstack:4566/",
region_name='eu-west-1',
aws_secret_access_key="x",
aws_access_key_id="x",
use_ssl=False,
).meta.client
for i in range(10):
client.create_queue(QueueName=str(i))
queues = client.list_queues()['QueueUrls']
assert len(queues) == 10
```
```
In [3]: %timeit for queue in client.list_queues()['QueueUrls']: client.purge_queue(QueueUrl=queue)
```
### Environment
```markdown
- OS: Ubuntu 22.04 LTS, Linux 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022 x86_64
- docker-compose 1.29.2
- Docker: 20.10.12, build 20.10.12-0ubuntu4
- LocalStack: 0.14.5
```
### Anything else?
Results don't improve over time, it's not a cold start issue.
https://github.com/localstack/localstack/issues/6398 | https://github.com/localstack/localstack/issues/6445 | https://github.com/localstack/localstack/pull/6558 | 7499b14bbd14d93a3ae6ecfd0cd24b8110b34801 | 4736afb30999b5e356e327d178f31a80da494cf0 | 2022-07-13T10:33:14Z | python | 2022-08-01T15:51:18Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,422 | ["localstack/aws/protocol/parser.py", "tests/integration/s3/test_s3.py", "tests/unit/aws/protocol/test_parser.py"] | bug: s3 get-object-attributes throws Unable to parse response, invalid XML received error | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
There is an issue with `get-object-attributes` command which results in below error always:
`aws --endpoint-url=http://localhost:4566 s3api get-object-attributes --bucket s3mock --key 20.txt --object-attributes "ObjectSize"`
````
> Response: Unable to parse response (syntax error: line 1, column 0), invalid XML received. Further retries may succeed:
b'98\n5\n'
````
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### Using docker-compse.yaml to start localstack
docker-compse.yaml:
```
localstack:
image: localstack/localstack:latest
ports:
- '4563-4599:4563-4599'
- '8055:8080'
environment:
- SERVICES=s3
- DEBUG=1
- LS_LOG=error
- DATA_DIR=/tmp/localstack/data
- AWS_DEFAULT_REGION=eu-west-1
# - EDGE_PORT=4566
volumes:
- "./.localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
```
#### cli commands to reproduce the issue
1. Create a Bucket: `aws --endpoint-url=http://localhost:4566 s3 mb s3://s3mock`
2. Create an Object: `aws --endpoint-url=http://localhost:4566 s3 cp data/20.txt s3://s3mock`
File 20.txt content are 2-digit numbers separated by newline.
3. get-object-attributes for object 20.txt :
```
aws --endpoint-url=http://localhost:4566 s3api get-object-attributes --bucket s3mock --key 20.txt --object-attributes "ObjectSize"
```
Results in error:
> Unable to parse response (syntax error: line 1, column 0), invalid XML received. Further retries may succeed:
b'98\n5\n'
### Environment
```markdown
- OS:Mac 12.x
- LocalStack:latest
- Node 14
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6422 | https://github.com/localstack/localstack/pull/6435 | 3a488951c7d7d4fa6dd1815f380f7791b9e041a1 | 2c85ccd81a17aee57211d915eacef6d127e46094 | 2022-07-08T14:27:08Z | python | 2022-07-12T12:51:20Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,419 | ["localstack/services/opensearch/cluster.py", "localstack/services/opensearch/cluster_manager.py", "localstack/services/opensearch/provider.py", "tests/integration/test_opensearch.py"] | bug: Unable to access elastic search endpoint return via domain command using port endpoint strategy | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I am using below docker-compose file to start the localstack container with es service
```
version: "3"
services:
wiremock:
image: "rodolpheche/wiremock"
ports:
- "8080"
localstack:
image: "localstack/localstack-full:0.14.2"
ports:
- "4566"
- "4510:4510"
environment:
AWS_ACCESS_KEY_ID: "local-access-key-id"
AWS_SECRET_ACCESS_KEY: "local-secret-access-key"
HOSTNAME_EXTERNAL: "localstack"
OPENSEARCH_ENDPOINT_STRATEGY: "port"
SERVICES: "es"
EDGE_PORT: "4566"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
```
running `aws --region ap-south-1 --endpoint-url http://localstack:4566 es create-elasticsearch-domain --domain-name my-domain` to create domain
this command is returning `localhost:4510` as an endpoint, I am able to curl `curl localhost:4510` within localstack bash but
neither on the host machine nor in `wiremock` container.
### Expected Behavior
I should able to access elastic search domain in host machine as well in another container
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack
```
version: "3"
services:
wiremock:
image: "rodolpheche/wiremock"
ports:
- "8080"
localstack:
image: "localstack/localstack-full:0.14.2"
ports:
- "4566"
- "4510:4510"
environment:
AWS_ACCESS_KEY_ID: "local-access-key-id"
AWS_SECRET_ACCESS_KEY: "local-secret-access-key"
HOSTNAME_EXTERNAL: "localstack"
OPENSEARCH_ENDPOINT_STRATEGY: "port"
SERVICES: "es"
EDGE_PORT: "4566"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
```
#### Client commands
aws --region ap-south-1 --endpoint-url http://localstack:4566 es create-elasticsearch-domain --domain-name my-domain
### Environment
```markdown
- OS:
- LocalStack:
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6419 | https://github.com/localstack/localstack/pull/6638 | f0fef3238e41d61c10795ed3720f43ea0ad13f90 | 5f2570ebd560a065e1f641db9074843abb8ec426 | 2022-07-08T09:24:09Z | python | 2022-08-24T11:42:54Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,416 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py", "tests/integration/test_sqs.snapshot.json"] | bug: SQS attribute ApproximateNumberOfMessagesDelayed not updated in latest(0.14.4) | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When I m defining a queue with 30s delay (DelaySeconds)
After sending message ApproximateNumberOfMessagesDelayed is still at 0
### Expected Behavior
Define a queue with 30s delay
Send a message
Verify value of ApproximateNumberOfMessagesDelayed in the queue, expected value should be 1.
This is working with release 0.14.2
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run localstack/localstack:latest
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
`
awslocal sqs create-queue --queue-name test --attributes '{"DelaySeconds":"30","MessageRetentionPeriod":"86400","ReceiveMessageWaitTimeSeconds":"0","VisibilityTimeout":"0"}'
awslocal sqs get-queue-attributes --attribute-names All --queue-url http://localhost:4566/000000000000/test
awslocal sqs send-message --queue-url http://localhost:4566/000000000000/test --message-body 'test'
awslocal sqs get-queue-attributes --attribute-names All --queue-url http://localhost:4566/000000000000/test
`
### Environment
```markdown
- OS:Ubuntu
- LocalStack:latest or 0.14.4
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6416 | https://github.com/localstack/localstack/pull/6591 | 60eff5296c0ac8bb95201c0fb64f790a008db5c8 | 9b15e4ab48f3da50d3c047c4d6810680c42d9eb2 | 2022-07-07T20:06:24Z | python | 2022-08-04T11:46:00Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,361 | ["localstack/services/plugins.py"] | implement service provider fallback | This issue has shown that, when we introduce new providers and propagate the configs to users, then remove the config ("asf" was removed and renamed to "default"), user configuration breaks
- #6358
One way of dealing with this is checking at startup time whether the configured providers are available, and if not, log a warning and fall back to the default provider. | https://github.com/localstack/localstack/issues/6361 | https://github.com/localstack/localstack/pull/6391 | 28ddb0d0adc8e7025d58530756adbcf257526b44 | 85c8855e0646e90440d88f99bc713bc28f7f6d04 | 2022-06-28T13:13:32Z | python | 2022-07-05T09:38:51Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,327 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | ContentBasedDeduplication not working correctly in FIFO queue | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I created an SQS FIFO queue with content based deduplication and sent a message that contains the same messageBody and attributes twice.
The message gets sent and received by the queue twice.
Im using the latest version of localstack with docker-compose.
### Expected Behavior
When ContetBasedDeduplication is set to true a message with the same body should only be recieved once by the queue during the 5 minute deduplication interval.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
create queue
```
sqs_client.create_queue(
QueueName='my_queue.fifo',
Attributes={
'FifoQueue': 'true',
'ContentBasedDeduplication': 'true'
},
)
```
send message
```
item = {'hello': 'hola'}
sqs_client.send_message(
QueueUrl='my_queue.fifo',
MessageBody=json.dumps(item),
MessageAttributes= {'hello': {'StringValue': 'hola', 'DataType': 'String'}},
MessageGroupId='group-1'
)
```
### Environment
```markdown
- OS:Ubuntu 20.04
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6327 | https://github.com/localstack/localstack/pull/6460 | b848ed372e7de1c83e029c479426a4f54e6a3e13 | 2860fb5417691d8ea7d96c60b7c7d819949ef73d | 2022-06-23T05:28:29Z | python | 2022-07-15T11:29:47Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,304 | ["localstack/aws/protocol/serializer.py", "tests/integration/test_opensearch.py", "tests/unit/aws/protocol/test_serializer.py"] | bug: OpenSearch domain error running Terraform destroy | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I'm using terraform to create/destroy infrastructure and specifically using Terratest & Localstack for testing purposes. I can create the OpenSearch domain without issues but when I try to destroy it fails and stop the rest of the destroy process.
```
[ERROR] vertex "module.opensearch.aws_elasticsearch_domain.opensearch (destroy)" error: error waiting for Elasticsearch Domain (arn:aws:es:us-east-1:000000000000:domain/testing) delete: : Domain not found: testing
status code: 409, request id: H9JVOYUA5R0OBS0JU8TIU2J4UHSJLTQ8DKFM412W34SUX67LV4P4
```
The domain is destroyed but because it fails checking the status after the destruction, the terraform state is corrupt, so even if you try to run a destroy after that, is going to fail because the domain is not there but the terraform state still have the information about it.
### Expected Behavior
Terraform should not fail destroying that, and I think is because of the way localstack is creating the response to the **_GET /2015-01-01/es/domain/testing HTTP/1.1_** request which terraform is using for checking when the destruction process is completed. I'll provide more details in the "**_Anything else?_**" section of the issue.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run --name manual-go-test -d --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
Using the attached files just follow this steps:
- terraform init
- terraform plan
- terraform apply (yes when asking)
- awslocal opensearch list-domain-names (for checking the domain creation)
- terraform destroy (yes when asking, to reproduce the error)
Expected terraform plan output:
```
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_elasticsearch_domain.opensearch will be created
+ resource "aws_elasticsearch_domain" "opensearch" {
+ access_policies = (known after apply)
+ advanced_options = (known after apply)
+ arn = (known after apply)
+ domain_id = (known after apply)
+ domain_name = "testing"
+ elasticsearch_version = "OpenSearch_1.1"
+ endpoint = (known after apply)
+ id = (known after apply)
+ kibana_endpoint = (known after apply)
+ tags_all = {
+ "Environment" = "Local"
+ "Service" = "LocalStack"
}
+ advanced_security_options {
+ enabled = (known after apply)
+ internal_user_database_enabled = (known after apply)
+ master_user_options {
+ master_user_arn = (known after apply)
+ master_user_name = (known after apply)
+ master_user_password = (sensitive value)
}
}
+ auto_tune_options {
+ desired_state = (known after apply)
+ rollback_on_disable = (known after apply)
+ maintenance_schedule {
+ cron_expression_for_recurrence = (known after apply)
+ start_at = (known after apply)
+ duration {
+ unit = (known after apply)
+ value = (known after apply)
}
}
}
+ cluster_config {
+ dedicated_master_count = 3
+ dedicated_master_enabled = true
+ dedicated_master_type = "m3.xlarge.elasticsearch"
+ instance_count = 3
+ instance_type = "m3.xlarge.elasticsearch"
+ warm_count = 3
+ warm_enabled = true
+ warm_type = "ultrawarm1.large.elasticsearch"
+ cold_storage_options {
+ enabled = (known after apply)
}
}
+ domain_endpoint_options {
+ custom_endpoint = (known after apply)
+ custom_endpoint_certificate_arn = (known after apply)
+ custom_endpoint_enabled = (known after apply)
+ enforce_https = (known after apply)
+ tls_security_policy = (known after apply)
}
+ ebs_options {
+ ebs_enabled = true
+ volume_size = 512
+ volume_type = "gp2"
}
+ encrypt_at_rest {
+ enabled = true
+ kms_key_id = (known after apply)
}
+ node_to_node_encryption {
+ enabled = true
}
}
# aws_iam_service_linked_role.es[0] will be created
+ resource "aws_iam_service_linked_role" "es" {
+ arn = (known after apply)
+ aws_service_name = "es.amazonaws.com"
+ create_date = (known after apply)
+ id = (known after apply)
+ name = (known after apply)
+ path = (known after apply)
+ tags_all = {
+ "Environment" = "Local"
+ "Service" = "LocalStack"
}
+ unique_id = (known after apply)
}
```
Terraform apply output:
```
aws_iam_service_linked_role.es[0]: Creating...
aws_iam_service_linked_role.es[0]: Creation complete after 1s [id=arn:aws:iam::000000000000:role/aws-service-role/es.amazonaws.com/r-8427ee25]
aws_elasticsearch_domain.opensearch: Creating...
aws_elasticsearch_domain.opensearch: Still creating... [10s elapsed]
aws_elasticsearch_domain.opensearch: Still creating... [20s elapsed]
aws_elasticsearch_domain.opensearch: Still creating... [30s elapsed]
aws_elasticsearch_domain.opensearch: Creation complete after 35s [id=arn:aws:es:us-east-1:000000000000:domain/testing]
```
Error on terraform destroy:
```
Error: error waiting for Elasticsearch Domain (arn:aws:es:us-east-1:000000000000:domain/testing) delete: : Domain not found: testing
│ status code: 409, request id: VCG59DH0QTJY4E96QBA50QRQHROVE9Y97OHKNH84FLPMU8KEM9Q3
```
I attached the providers.tf and the main.tf needed to reproduce the error with terraform. Both in a zip
[LocalStackOsIssue.zip](https://github.com/localstack/localstack/files/8939898/LocalStackOsIssue.zip)
.
### Environment
```markdown
- OS:macOS Monterrey 12.4
- LocalStack: latest
- Terraform: v1.2.2
- Terraform AWS Provider: hashicorp/aws 4.18.0
```
### Anything else?
After testing the same terraform files against aws and localstack we found this difference in the response of the **_GET /2015-01-01/es/domain/testing HTTP/1.1_** request that maybe is the root of the issue:
This is the response from AWS which works with terraform without problem:
```
---[ RESPONSE ]--------------------------------------
HTTP/1.1 409 Conflict
Content-Length: 39
Content-Type: application/json
Date: Wed, 15 Jun 2022 15:27:29 GMT
X-Amzn-Errortype: ResourceNotFoundException
X-Amzn-Requestid: fa4ds5f4-b5ef-4643-7d8f-689ec443b642
-----------------------------------------------------: timestamp=2022-06-15T17:27:30.735+0200
2022-06-15T17:27:30.735+0200 [DEBUG] provider.terraform-provider-aws_v4.18.0_x5: [aws-sdk-go] {"message":"Domain not found: testing"}: timestamp=2022-06-15T17:27:30.735+0200
2
```
This is the response from Localstack
```
---[ RESPONSE ]--------------------------------------
HTTP/1.1 409
Connection: close
Access-Control-Allow-Headers: authorization,cache-control,content-length,content-md5,content-type,etag,location,x-amz-acl,x-amz-content-sha256,x-amz-date,x-amz-request-id,x-amz-security-token,x-amz-tagging,x-amz-target,x-amz-user-agent,x-amz-version-id,x-amzn-requestid,x-localstack-target,amz-sdk-invocation-id,amz-sdk-request
Access-Control-Allow-Methods: HEAD,GET,PUT,POST,DELETE,OPTIONS,PATCH
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: etag,x-amz-version-id
Content-Type: application/json
Date: Wed, 15 Jun 2022 14:06:22 GMT
Server: hypercorn-h11
X-Amz-Request-Id: AQGT79VIOT0IP7L3C82N9JGH4OQFU0FHOW1SSLFGBXK5AJO9ZH6O
X-Amzn-Requestid: H9JVOYUA5R0OBS0JU8TIU2J4UHSJLTQ8DKFM412W34SUX67LV4P4
-----------------------------------------------------: timestamp=2022-06-15T16:06:22.090+0200
2022-06-15T16:06:22.090+0200 [DEBUG] provider.terraform-provider-aws_v4.18.0_x5: [aws-sdk-go] {"__type": "ResourceNotFoundException", "message": "Domain not found: testing"}: timestamp=2022-06-15T16:06:22.090+0200
```
As you can see, AWS is settinh the "X-Amzn-Errortype" header with the "ResourceNotFoundException" not in the body. We were looking into the terraform code and the AWS GO SDK and they use the header X-Amzn-Errortype to check if it is a ResourceNotFoundException. Maybe just adding that in Localstack is going to be enough to make it work. We also see in the localstack history that something similar was added to kinesis.
This is a list of links following the possible trace of the error theory
- https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/opensearch/domain.go#L1034
- https://github.com/hashicorp/terraform-provider-aws/blob/a68d32b3cc5189ab3bc039dbeaf3836d75e8d0ee/internal/service/elasticsearch/wait.go#L104
- https://github.com/hashicorp/terraform-provider-aws/blob/a68d32b3cc5189ab3bc039dbeaf3836d75e8d0ee/internal/service/elasticsearch/find.go#L11
- https://github.com/hashicorp/terraform-provider-aws/blob/a68d32b3cc5189ab3bc039dbeaf3836d75e8d0ee/internal/tfresource/not_found_error.go#L31
- https://github.com/aws/aws-sdk-go/blob/main/service/elasticsearchservice/api.go#L1380
- https://github.com/aws/aws-sdk-go/blob/main/service/elasticsearchservice/api.go#L1396 | https://github.com/localstack/localstack/issues/6304 | https://github.com/localstack/localstack/pull/6370 | 8afcec477f5cc9b9c2b12aa58fd575686913b865 | 8fe72c17135e03d3d95dfb8cb6012487734246ac | 2022-06-20T10:49:32Z | python | 2022-07-01T18:03:48Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,245 | ["localstack/services/sns/provider.py", "tests/integration/test_notifications.py", "tests/integration/test_sns.py", "tests/integration/test_sns.snapshot.json", "tests/unit/test_sns.py"] | Class cast Exception while reading message attributes from SNS event records | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
### Issue
I deployed jar as lambda function in localstack triggered by SNS Event. I published a compressed payload to SNS topic which triggered my lambda function. During runtime, SNS Event to my lambda handler comes with message attribute by name Format Type. While extracting SNSEvent.MessageAttribute, the object is coming as LinkedHashMap and am getting an exception
### Exception Message
Exception in thread "main" java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class com.amazonaws.services.lambda.runtime.events.SNSEvent$MessageAttribute (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; com.amazonaws.services.lambda.runtime.events.SNSEvent$MessageAttribute is in unnamed module of loader 'app')
### IDE screenshot
<img width="1104" alt="Screen Shot 2022-06-09 at 10 11 17 PM" src="https://user-images.githubusercontent.com/11893250/172999694-24a1f879-3a4f-45d4-8a94-98c325d61334.png">
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6245 | https://github.com/localstack/localstack/pull/6373 | f643410ec1aa979038e90b8d74393115bce897e5 | 8afcec477f5cc9b9c2b12aa58fd575686913b865 | 2022-06-10T06:00:54Z | python | 2022-07-01T18:00:26Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,163 | ["localstack/services/cloudformation/models/__init__.py", "localstack/services/cloudformation/models/opensearch.py", "localstack/utils/cloudformation/template_deployer.py", "tests/integration/templates/opensearch_domain.yaml", "tests/integration/test_opensearch.py"] | question: Are there any plans to add AWS::OpenSearchService::Domain resource? | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
I am using serverless framework with localstack and I am unable to define an `AWS::OpenSearchService::Domain` resource. I guess I'll have to use `AWS::Elasticsearch::Domain` instead but it is deprecated. Are there any plans to add `AWS::OpenSearchService::Domain` resource soon?
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6163 | https://github.com/localstack/localstack/pull/6199 | 267631b9c17dc3047d671c4541cbd1d022b8937d | c05736fb808860b6327ce400bce7ddf988af4338 | 2022-05-29T23:06:24Z | python | 2022-06-07T10:39:47Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,157 | ["localstack/config.py"] | After Install: ImportError: cannot import name 'Literal' from 'typing' | I followed the instructions for installing localstack running the following command:
`python3 -m pip install localstack`
Then, I ran localstack:
`python3 -m localstack.cli.main`
Which throws the following error:
`ImportError: cannot import name 'Literal' from 'typing' (/usr/lib64/python3.7/typing.py)` | https://github.com/localstack/localstack/issues/6157 | https://github.com/localstack/localstack/pull/6231 | ff5febce20d75dc1ee58ca8031809eb26c8c2537 | d7b10447c6a57d477867a314ea4b2310b7433430 | 2022-05-27T19:32:34Z | python | 2022-06-08T10:46:33Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,155 | ["localstack/utils/cloudformation/template_deployer.py", "tests/integration/cloudformation/api/test_stacks.py", "tests/integration/cloudformation/api/test_stacks.snapshot.json", "tests/integration/templates/stack_update_1.yaml", "tests/integration/templates/stack_update_2.yaml", "tests/integration/templates/stack_update_3.yaml"] | samlocal not returning on second and later deploys | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When executing samlocal deploy twice without updating the template it gets stuck after the deploy step (before the step of the output is shown)
Also i left it running for long time checking if it could finish and around 2 hours laters a kinesis stacktrace appeared on the logs on the docker container
```
localstack_main | 2022-05-26T09:14:21.135:INFO:localstack.services.kinesis.kinesis_mock_server: [io-compute-1] WARN 2022-05-26 09:14:21,132 k.m.cache.Cache x-amzn-RequestId=3a527f8b-dcd4-11ec-ac09-ad4f3aa847a9, action=GetRecords, contextId=3a527f8a-dcd4-11ec-ac09-ad4f3aa847a9, x-amz-id-2=WLxUzW0heAIF5/pAXeHZEM0qejb1MRVum6fgYxuWPz146y+KGwkjmNwjv9IWngSM8RaihKhqcdibbhN4kruU+3p8/FlKZnTp, contentType=application/x-amz-json-1.1 - Getting records was unuccessful
localstack_main | 2022-05-26T09:14:21.135:INFO:localstack.services.kinesis.kinesis_mock_server: kinesis.mock.ExpiredIteratorException: The shard iterator has expired. Shard iterators are only valid for 300 seconds
localstack_main | 2022-05-26T09:14:21.135:INFO:localstack.services.kinesis.kinesis_mock_server: at kinesis.mock.models.ShardIterator.parse(ShardIterator.scala:58)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at kinesis.mock.api.GetRecordsRequest.$anonfun$getRecords$1(GetRecordsRequest.scala:24)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at cats.effect.IOFiber.runLoop(IOFiber.scala:358)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at cats.effect.IOFiber.asyncContinueSuccessfulR(IOFiber.scala:1338)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at cats.effect.IOFiber.run(IOFiber.scala:140)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:549)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
localstack_main | 2022-05-26T09:14:21.136:INFO:localstack.services.kinesis.kinesis_mock_server: at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
localstack_main | 2022-05-26T09:14:21.140:DEBUG:localstack.services.dynamodbstreams.provider: Shard iterator for underlying kinesis stream expired
localstack_main | 2022-05-26T09:14:21.146:INFO:localstack.utils.threads: Thread run method <bound method StreamEventSourceListener._listen_to_shard_and_invoke_lambda of <localstack.services.awslambda.event_source_listeners.dynamodb_event_source_listener.DynamoDBEventSourceListener object at 0x7fa9b98dbb50>>({'function_arn': 'arn:aws:lambda:us-west-2:000000000000:function:sandbox-events-generator-worker', 'stream_arn': 'arn:aws:dynamodb:us-west-2:000000000000:table/sandbox-events-generator-jobs/stream/2022-05-26T07:20:41.621', 'batch_size': 1, 'parallelization_factor': 1, 'lock_discriminator': '60cf3f5b-11af-4b81-840b-c62920e5f0cb/arn:aws:dynamodb:us-west-2:000000000000:table/sandbox-events-generator-jobs/stream/2022-05-26T07:20:41.621/shardId-00000001653500000000-000000000000', 'shard_id': 'shardId-00000001653500000000-000000000000', 'stream_client': <botocore.client.DynamoDBStreams object at 0x7fa9bc321810>, 'shard_iterator': 'AAAAAAAAAAEqli29q/ZrvGK0Qv58Ys0UOaNNnguVf1262Mr190addTsT21HR/XdUWnOyHg1FUUW4R774Gy1X2lmyJQMqkTKuh5nVySaVOmGBrjNRHabrLqpzejZqpTYba8lThyNRgs95fCdid2O4GmMSpaBEXElMSDpWQ/LU/Hb5NG3P0pInAfuajJsFpH8TjqTbNHNf3EBxC0OYM1EfSBu183HSLUkECOBmWfp87OOWPH+WiWiWzQ==', 'failure_destination': None, 'max_num_retries': inf}) failed: An error occurred (ExpiredIteratorException) when calling the GetRecords operation: Shard iterator has expired Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/utils/threads.py", line 39, in run
localstack_main | result = self.func(self.params, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/awslambda/event_source_listeners/stream_event_source_listener.py", line 182, in _listen_to_shard_and_invoke_lambda
localstack_main | records_response = stream_client.get_records(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 508, in _api_call
localstack_main | return self._make_api_call(operation_name, kwargs)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 911, in _make_api_call
localstack_main | raise error_class(parsed_response, operation_name)
localstack_main | botocore.errorfactory.ExpiredIteratorException: An error occurred (ExpiredIteratorException) when calling the GetRecords operation: Shard iterator has expired
```
### Expected Behavior
the command finishes properly like in the first run
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose up -d
docker-compose.yml:
```
version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack:latest
network_mode: bridge
ports:
- "127.0.0.1:53:53" # only required for Pro (DNS)
- "127.0.0.1:53:53/udp" # only required for Pro (DNS)
- "127.0.0.1:443:443" # only required for Pro (LocalStack HTTPS Edge Proxy)
- "127.0.0.1:4510-4559:4510-4559" # external service port range
- "127.0.0.1:4566:4566" # LocalStack Edge Proxy
environment:
- SERVICES=dynamodb,cloudformation,lambda,s3,sts,apigateway,iam
- DEBUG=1
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
net1:
ipv4_address: 10.10.100.3
networks:
net1:
driver: bridge
enable_ipv6: false
ipam:
config:
- subnet: 10.10.100.0/24
gateway: 10.10.100.32
```
template.yaml
```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
test-sam
SAM Template for test
Parameters:
Environment:
Type: String
Default: sandbox
Project:
Type: String
Default: project
Component:
Type: String
Default: component
DynamoDBUrl:
Type: String
Default: LOCALSTACK_HOSTNAME
UseLocalstack:
Type: String
Default: 'true'
AllowedValues: [true, false]
Conditions:
UseLocalStack: !Equals [!Ref UseLocalstack, 'true']
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 360
Environment:
Variables:
REGION: !Ref "AWS::Region"
ENVIRONMENT: !Ref Environment
PROJECT: !Ref Project
COMPONENT: !Ref Component
DYNAMO_DB_JOB_TABLE: !Ref JobTable
DYNAMO_DB_URL: !Ref DynamoDBUrl
Resources:
TestFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Join [ "-", [ !Ref Environment, !Ref Component, "api" ] ]
CodeUri: api/
Handler: api
Runtime: go1.x
Architectures:
- x86_64
Tracing: Active
Events:
CatchAll:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /{proxy+}
Method: ANY
Environment:
Variables:
API_GATEWAY_V1_ENDPOINT: !Sub "http://localhost:4566/restapis/${ApiGatewayIdV1}/"
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref JobTable
- AmazonAPIGatewayInvokeFullAccess
WorkerFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Join [ "-", [ !Ref Environment, !Ref Component, "worker" ] ]
CodeUri: worker/
Handler: worker
Runtime: go1.x
Architectures:
- x86_64
MemorySize: 512
Timeout: 180
Tracing: Active
Events:
JobTable:
Type: DynamoDB
Properties:
Stream: !GetAtt JobTable.StreamArn
StartingPosition: TRIM_HORIZON
BatchSize: 1
Environment:
Variables:
API_GATEWAY_ENDPOINT: !Sub "http://localhost:4566/restapis/${ApiGatewayIdV2}/"
API_GATEWAY_BULK_ENDPOINT: !Sub "http://localhost:4566/restapis/${ApiGatewayIdV2}/"
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref JobTable
- AmazonSNSFullAccess
- AmazonAPIGatewayInvokeFullAccess
JobTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Join [ "-", [ !Ref Environment, !Ref Component, "jobs" ] ]
AttributeDefinitions:
- AttributeName: Id
AttributeType: S
KeySchema:
- AttributeName: Id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
StreamSpecification:
StreamViewType: NEW_IMAGE
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
EventsGeneratorAPI:
Description: "API Gateway endpoint URL for Prod environment for First Function"
Value: !Sub "http://localhost:4566/restapis/${ServerlessRestApi}/Prod/api/"
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal s3 mb s3://mybucket
### Environment
```markdown
- OS:
MacOS Monterey 12.4
- LocalStack:
LocalStack version: 0.14.3.1
LocalStack Docker container id: 95b639ae197e
LocalStack build date: 2022-05-25
LocalStack build git hash: 2a564393
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6155 | https://github.com/localstack/localstack/pull/7272 | 0bf2ae219dceb9edc6a9f9884f813030e219858a | 732a8e743f222b1375b2c91113bb5cc8c217ae75 | 2022-05-26T20:26:32Z | python | 2022-12-02T14:33:54Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,146 | ["localstack/aws/forwarder.py", "localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | bug: Received SQS message attribute ApproximateFirstReceiveTimestamp is a floating point value instead of an integer timestamp | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
SQS message attribute `ApproximateFirstReceiveTimestamp` has a decimal value in addition to the timestamp integer. Example response payload from a `sqs receive-message` request:
```
{
"Messages": [
{
"MessageId": "4392033b-e522-4f76-bd93-f9ea24acecec",
"ReceiptHandle": "MmJiYmI1YzUtMWFkYy00YWMzLTlmNGUtMjA4ZjM2MGNlNzRlIGFybjphd3M6c3FzOnVzLWVhc3QtMTowMDAwMDAwMDAwMDA6dGVzdC1xdWV1ZSA0MzkyMDMzYi1lNTIyLTRmNzYtYmQ5My1mOWVhMjRhY2VjZWMgMTY1MzQ5OTMyOS44MzI4NzAy",
"MD5OfBody": "4e121647549e21089f8d89c271f2e344",
"Body": "this is a test",
"Attributes": {
"SenderId": "000000000000",
"SentTimestamp": "1653499304",
"ApproximateReceiveCount": "1",
"ApproximateFirstReceiveTimestamp": "1653499329.8328702"
}
}
]
}
```
This is troublesome when attempting to parse the attribute string value, as libraries such as [amazon-sqs-java-temporary-queues-client](https://github.com/awslabs/amazon-sqs-java-temporary-queues-client) perform a direct `Long.parseLong(string)` on the attribute value, which results in an exception being thrown since the input string contains a decimal value.
### Expected Behavior
The SQS message attribute `ApproximateFirstReceiveTimestamp` value should be an integer timestamp, just like the `SentTimestamp` attribute value. Example expected response payload from a `sqs receive-message` request:
```
{
"Messages": [
{
"MessageId": "4392033b-e522-4f76-bd93-f9ea24acecec",
"ReceiptHandle": "MmJiYmI1YzUtMWFkYy00YWMzLTlmNGUtMjA4ZjM2MGNlNzRlIGFybjphd3M6c3FzOnVzLWVhc3QtMTowMDAwMDAwMDAwMDA6dGVzdC1xdWV1ZSA0MzkyMDMzYi1lNTIyLTRmNzYtYmQ5My1mOWVhMjRhY2VjZWMgMTY1MzQ5OTMyOS44MzI4NzAy",
"MD5OfBody": "4e121647549e21089f8d89c271f2e344",
"Body": "this is a test",
"Attributes": {
"SenderId": "000000000000",
"SentTimestamp": "1653499304",
"ApproximateReceiveCount": "1",
"ApproximateFirstReceiveTimestamp": "1653499329"
}
}
]
}
```
### How are you starting LocalStack?
Custom (please describe below)
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
I am deploying LocalStack in a local Kubernetes cluster via Minikube.
##### localstack.yaml
```
apiVersion: v1
kind: ConfigMap
metadata:
name: localstack-config
data:
init.sh: |
#!bin/bash
set -e
echo "Creating AWS profile."
aws configure set aws_access_key_id test
aws configure set aws_secret_access_key test
aws configure set region us-east-1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: localstack
spec:
selector:
matchLabels:
app: localstack
template:
metadata:
labels:
app: localstack
spec:
containers:
- name: localstack
image: localstack/localstack:latest
imagePullPolicy: Always
ports:
- containerPort: 4566
env:
- name: SERVICES
value: "sqs"
volumeMounts:
- name: localstack-init-volume
mountPath: /docker-entrypoint-initaws.d
volumes:
- name: localstack-init-volume
configMap:
name: localstack-config
serviceName: localstack-service
---
apiVersion: v1
kind: Service
metadata:
name: localstack-service
labels:
app: localstack
spec:
selector:
app: localstack
ports:
- port: 4566
protocol: TCP
```
`kubectl apply -f kubernetes/localstack.yaml`
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
kubectl exec localstack-0 -- awslocal sqs create-queue --queue-name test-queue
kubectl exec localstack-0 -- awslocal sqs send-message --queue-url "http://localhost:4566/000000000000/test-queue" --message-body "this is a test"
kubectl exec localstack-0 -- awslocal sqs receive-message --queue-url "http://localhost:4566/000000000000/test-queue" --attribute-names All
I haven't tried this on docker-compose as I don't use that, but given the nature of this bug I'd suspect that the same issue would exist there regardless of how LocalStack is started.
### Environment
```markdown
- OS: macOS Monterey 12.4
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6146 | https://github.com/localstack/localstack/pull/6147 | 2a564393d57a75f59206e2be16da0002c9019d2d | 5f46acaa9759d854366fc57717f45de19f500fe1 | 2022-05-25T19:20:51Z | python | 2022-05-26T11:06:14Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,143 | ["localstack/services/iam/provider.py", "localstack/utils/cloudformation/template_preparer.py", "tests/integration/cloudformation/test_cloudformation_sam.py", "tests/integration/templates/sam_function-policies.yaml"] | Failing when creating a new policy inside lambda | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
The first time you run samlocal deploy --guided, once starts the deploy it fails with this error inside the docker image.
```localstack_main | 2022-05-25T14:56:42.418:WARNING:localstack.utils.server.http2_server: Error in proxy handler for request POST http://localhost:4566/: 'AmazonSNSFullAccessLS' Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/aws/forwarder.py", line 57, in _call
localstack_main | return handler(context, req)
localstack_main | File "/opt/code/localstack/localstack/aws/skeleton.py", line 117, in __call__
localstack_main | return self.fn(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/aws/api/core.py", line 95, in operation_marker
localstack_main | return fn(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/aws/api/iam/__init__.py", line 2257, in attach_role_policy
localstack_main | raise NotImplementedError
localstack_main | NotImplementedError
localstack_main |
localstack_main | During handling of the above exception, another exception occurred:
localstack_main |
localstack_main | Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/utils/server/http2_server.py", line 185, in index
localstack_main | result = await run_sync(handler, request, data)
localstack_main | File "/opt/code/localstack/localstack/utils/asyncio.py", line 85, in run_sync
localstack_main | return await loop.run_in_executor(thread_pool, copy_context().run, func_wrapped)
localstack_main | File "/opt/code/localstack/localstack/utils/threads.py", line 39, in run
localstack_main | result = self.func(self.params, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/utils/asyncio.py", line 30, in _run
localstack_main | return fn(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 991, in handler
localstack_main | return modify_and_forward(
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 533, in wrapper
localstack_main | value = func(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 613, in modify_and_forward
localstack_main | listener_result = listener.forward_request(
localstack_main | File "/opt/code/localstack/localstack/services/edge.py", line 170, in forward_request
localstack_main | result = do_forward_request(api, method, path, data, headers, port=port)
localstack_main | File "/opt/code/localstack/localstack/services/edge.py", line 225, in do_forward_request
localstack_main | result = do_forward_request_inmem(api, method, path, data, headers, port=port)
localstack_main | File "/opt/code/localstack/localstack/services/edge.py", line 249, in do_forward_request_inmem
localstack_main | response = modify_and_forward(
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 533, in wrapper
localstack_main | value = func(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 613, in modify_and_forward
localstack_main | listener_result = listener.forward_request(
localstack_main | File "/opt/code/localstack/localstack/http/adapters.py", line 51, in forward_request
localstack_main | response = self.request(request)
localstack_main | File "/opt/code/localstack/localstack/aws/proxy.py", line 42, in request
localstack_main | return self.skeleton.invoke(context)
localstack_main | File "/opt/code/localstack/localstack/aws/skeleton.py", line 153, in invoke
localstack_main | return self.dispatch_request(context, instance)
localstack_main | File "/opt/code/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request
localstack_main | result = handler(context, instance) or {}
localstack_main | File "/opt/code/localstack/localstack/aws/forwarder.py", line 59, in _call
localstack_main | return fallthrough_handler(context, req)
localstack_main | File "/opt/code/localstack/localstack/services/moto.py", line 108, in proxy_moto
localstack_main | status, headers, content = dispatch_to_moto(context)
localstack_main | File "/opt/code/localstack/localstack/services/moto.py", line 137, in dispatch_to_moto
localstack_main | return dispatch(request, request.url, request.headers)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/core/responses.py", line 205, in dispatch
localstack_main | return cls()._dispatch(*args, **kwargs)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/core/responses.py", line 315, in _dispatch
localstack_main | return self.call_action()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/core/responses.py", line 405, in call_action
localstack_main | response = method()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/iam/responses.py", line 10, in attach_role_policy
localstack_main | iam_backend.attach_role_policy(policy_arn, role_name)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/iam/models.py", line 1596, in attach_role_policy
localstack_main | policy = arns[policy_arn]
localstack_main | KeyError: 'AmazonSNSFullAccessLS'
localstack_main |
localstack_main | 2022-05-25T14:56:42.418:INFO:localstack.utils.threads: Thread run method <function AdaptiveThreadPool.submit.<locals>._run at 0x7fb972d2ab90>(None) failed: 'AmazonSNSFullAccessLS' Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/aws/forwarder.py", line 57, in _call
localstack_main | return handler(context, req)
localstack_main | File "/opt/code/localstack/localstack/aws/skeleton.py", line 117, in __call__
localstack_main | return self.fn(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/aws/api/core.py", line 95, in operation_marker
localstack_main | return fn(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/aws/api/iam/__init__.py", line 2257, in attach_role_policy
localstack_main | raise NotImplementedError
localstack_main | NotImplementedError
localstack_main |
localstack_main | During handling of the above exception, another exception occurred:
localstack_main |
localstack_main | Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/utils/threads.py", line 39, in run
localstack_main | result = self.func(self.params, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/utils/asyncio.py", line 30, in _run
localstack_main | return fn(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 991, in handler
localstack_main | return modify_and_forward(
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 533, in wrapper
localstack_main | value = func(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 613, in modify_and_forward
localstack_main | listener_result = listener.forward_request(
localstack_main | File "/opt/code/localstack/localstack/services/edge.py", line 170, in forward_request
localstack_main | result = do_forward_request(api, method, path, data, headers, port=port)
localstack_main | File "/opt/code/localstack/localstack/services/edge.py", line 225, in do_forward_request
localstack_main | result = do_forward_request_inmem(api, method, path, data, headers, port=port)
localstack_main | File "/opt/code/localstack/localstack/services/edge.py", line 249, in do_forward_request_inmem
localstack_main | response = modify_and_forward(
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 533, in wrapper
localstack_main | value = func(*args, **kwargs)
localstack_main | File "/opt/code/localstack/localstack/services/generic_proxy.py", line 613, in modify_and_forward
localstack_main | listener_result = listener.forward_request(
localstack_main | File "/opt/code/localstack/localstack/http/adapters.py", line 51, in forward_request
localstack_main | response = self.request(request)
localstack_main | File "/opt/code/localstack/localstack/aws/proxy.py", line 42, in request
localstack_main | return self.skeleton.invoke(context)
localstack_main | File "/opt/code/localstack/localstack/aws/skeleton.py", line 153, in invoke
localstack_main | return self.dispatch_request(context, instance)
localstack_main | File "/opt/code/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request
localstack_main | result = handler(context, instance) or {}
localstack_main | File "/opt/code/localstack/localstack/aws/forwarder.py", line 59, in _call
localstack_main | return fallthrough_handler(context, req)
localstack_main | File "/opt/code/localstack/localstack/services/moto.py", line 108, in proxy_moto
localstack_main | status, headers, content = dispatch_to_moto(context)
localstack_main | File "/opt/code/localstack/localstack/services/moto.py", line 137, in dispatch_to_moto
localstack_main | return dispatch(request, request.url, request.headers)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/core/responses.py", line 205, in dispatch
localstack_main | return cls()._dispatch(*args, **kwargs)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/core/responses.py", line 315, in _dispatch
localstack_main | return self.call_action()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/core/responses.py", line 405, in call_action
localstack_main | response = method()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/iam/responses.py", line 10, in attach_role_policy
localstack_main | iam_backend.attach_role_policy(policy_arn, role_name)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/moto/iam/models.py", line 1596, in attach_role_policy
localstack_main | policy = arns[policy_arn]
localstack_main | KeyError: 'AmazonSNSFullAccessLS'
localstack_main |
localstack_main | 2022-05-25T14:56:42.418:DEBUG:localstack.utils.threads: FINISHED: <Future at 0x7fb975064af0 state=finished raised KeyError>
localstack_main | 2022-05-25T14:56:42.420:DEBUG:localstack.utils.cloudformation.template_deployer: Error applying changes for CloudFormation stack "test": Unable to parse response (not well-formed (invalid token): line 1, column 0), invalid XML received. Further retries may succeed:
localstack_main | b'{}' Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 502, in _parse_xml_string_to_dom
localstack_main | parser.feed(xml_string)
localstack_main | xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0
localstack_main |
localstack_main | During handling of the above exception, another exception occurred:
localstack_main |
localstack_main | Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1546, in _run
localstack_main | self.do_apply_changes_in_loop(changes, stack, stack_name)
localstack_main | File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1616, in do_apply_changes_in_loop
localstack_main | self.apply_change(change, stack=stack)
localstack_main | File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1682, in apply_change
localstack_main | result = deploy_resource(self, resource_id)
localstack_main | File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 844, in deploy_resource
localstack_main | result = execute_resource_action(resource_id, stack, ACTION_CREATE)
localstack_main | File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 880, in execute_resource_action
localstack_main | result = func["function"](resource_id, resources, resource_type, func, stack_name)
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/models/iam.py", line 233, in _post_create
localstack_main | iam.attach_role_policy(RoleName=role_name, PolicyArn=arn)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 508, in _api_call
localstack_main | return self._make_api_call(operation_name, kwargs)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 894, in _make_api_call
localstack_main | http, parsed_response = self._make_request(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/client.py", line 917, in _make_request
localstack_main | return self._endpoint.make_request(operation_model, request_dict)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/endpoint.py", line 116, in make_request
localstack_main | return self._send_request(request_dict, operation_model)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/endpoint.py", line 196, in _send_request
localstack_main | success_response, exception = self._get_response(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/endpoint.py", line 238, in _get_response
localstack_main | success_response, exception = self._do_get_response(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/endpoint.py", line 305, in _do_get_response
localstack_main | parsed_response = parser.parse(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 249, in parse
localstack_main | parsed = self._do_error_parse(response, shape)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 556, in _do_error_parse
localstack_main | root = self._parse_xml_string_to_dom(xml_contents)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 505, in _parse_xml_string_to_dom
localstack_main | raise ResponseParserError(
localstack_main | botocore.parsers.ResponseParserError: Unable to parse response (not well-formed (invalid token): line 1, column 0), invalid XML received. Further retries may succeed:
localstack_main | b'{}'
```
### Expected Behavior
Create the stack properly and link the IAM policy properly. If you declare the policy inline inside the sam template it works properly.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose.yml
```
version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack:0.14.3
network_mode: bridge
ports:
- "127.0.0.1:53:53" # only required for Pro (DNS)
- "127.0.0.1:53:53/udp" # only required for Pro (DNS)
- "127.0.0.1:443:443" # only required for Pro (LocalStack HTTPS Edge Proxy)
- "127.0.0.1:4510-4559:4510-4559" # external service port range
- "127.0.0.1:4566:4566" # LocalStack Edge Proxy
environment:
- SERVICES=dynamodb,cloudformation,lambda,s3,sts,apigateway,iam
- DEBUG=1
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
net1:
ipv4_address: 10.10.100.3
networks:
net1:
driver: bridge
enable_ipv6: false
ipam:
config:
- subnet: 10.10.100.0/24
gateway: 10.10.100.32
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
template.yml
```AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
events-generator-sam
SAM Template test
Parameters:
Environment:
Type: String
Default: sandbox
Project:
Type: String
Default: test
Component:
Type: String
Default: test
ApiGatewayIdV1:
Type: String
Default: abc1234
ApiGatewayIdV2:
Type: String
Default: wxyz789
DynamoDBUrl:
Type: String
Default: LOCALSTACK_HOSTNAME
UseLocalStack:
Type: String
Default: "true"
Conditions:
UseLocalStack: !Equals [ !Ref UseLocalStack, "true" ]
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 360
Environment:
Variables:
REGION: !Ref "AWS::Region"
ENVIRONMENT: !Ref Environment
PROJECT: !Ref Project
COMPONENT: !Ref Component
DYNAMO_DB_JOB_TABLE: !Ref JobTable
DYNAMO_DB_URL: !Ref DynamoDBUrl
Resources:
TestFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Join [ "-", [ !Ref Environment, !Ref Component, "api" ] ]
CodeUri: api/
Handler: api
Runtime: go1.x
Architectures:
- x86_64
Tracing: Active
Events:
CatchAll:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /{proxy+}
Method: ANY
Environment:
Variables:
.....
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref JobTable
- AmazonAPIGatewayInvokeFullAccess
WorkerFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Join [ "-", [ !Ref Environment, !Ref Component, "worker" ] ]
CodeUri: worker/
Handler: worker
Runtime: go1.x
Architectures:
- x86_64
MemorySize: 512
Timeout: 180
Tracing: Active
Events:
JobTable:
Type: DynamoDB
Properties:
Stream: !GetAtt JobTable.StreamArn
StartingPosition: TRIM_HORIZON
BatchSize: 1
Environment:
Variables:
....
Policies:
- DynamoDBCrudPolicy: # localStack complains because the policy name is < 20 char
TableName: !Ref JobTable
- Fn::If:
- UseLocalStack
- AmazonSNSFullAccessLS
- AmazonSNSFullAccess # localStack complains because the policy name is < 20 char
- AmazonAPIGatewayInvokeFullAccess
JobTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Join [ "-", [ !Ref Environment, !Ref Component, "jobs" ] ]
AttributeDefinitions:
- AttributeName: Id
AttributeType: S
KeySchema:
- AttributeName: Id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
StreamSpecification:
StreamViewType: NEW_IMAGE
Outputs:
....
```
```
awslocal iam create-policy --policy-name AmazonSNSFullAccessLS --policy-document '{"Version":"2012-10-17","Statement":[{"Action":["sns:*"],"Effect":"Allow","Resource":"*"}]}'
awslocal iam create-policy --policy-name AmazonAPIGatewayInvokeFullAccess --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["execute-api:Invoke","execute-api:ManageConnections"],"Resource":"arn:aws:execute-api:*:*:*"}]}'
samlocal build && samlocal deploy --guided
```
### Environment
```markdown
- OS: Mac os Monterrey
- LocalStack: 0.14.3
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6143 | https://github.com/localstack/localstack/pull/6148 | faf5d421dbecdb9c31bfb9f874e13c2fade87ab8 | 2a564393d57a75f59206e2be16da0002c9019d2d | 2022-05-25T15:25:12Z | python | 2022-05-25T22:12:46Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,134 | ["localstack/services/apigateway/integration.py", "localstack/services/apigateway/invocations.py", "tests/integration/awslambda/test_lambda_integration.py"] | bug: REST ApiGateway responses header content-type always text/html | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I Created an REST APIGatway with lambda handler using AWS CDK. when I hit the API the response header content type is always set to "text/html" instead of `application/json` . even if I changed the response template or added the header to lambda returned response. when I deploy the same stack on AWS account the response header is fine and work as expected
### Expected Behavior
Response Header content-type to be `application/json`
### How are you starting LocalStack?
`localstack start` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command`)
`localstack start` command
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
I'm using AWS CDK typescript application and deploy it using `cdklocal` command on localstack
Using CDK follow the steps:
- create REST ApiGateway
- create Lambda function
- integrate lambda with APIGatway
On Command line:
- deploy using `cdklocal deploy` command
Finally
- test the endpoint and check the response header content-type
### Environment
```markdown
- OS: Windows
- LocalStack: latest
```
### Anything else?
When I deploy the same stack on AWS account everything works fine and the response header content-type is `application/json` | https://github.com/localstack/localstack/issues/6134 | https://github.com/localstack/localstack/pull/6408 | 8c7449864f8b9e74a709edbc78511e19246cf718 | e2c1dd66cd97264048cd94f623fc243a2d4e895b | 2022-05-24T18:50:36Z | python | 2022-07-08T08:11:11Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,111 | ["Makefile", "bin/lambda/Dockerfile.nodejs14x", "localstack/contrib/thundra.py", "localstack/services/awslambda/lambda_executors.py", "localstack/services/awslambda/lambda_utils.py", "tests/integration/awslambda/test_lambda.py", "tests/integration/awslambda/test_lambda.snapshot.json"] | feature request: Support mapping of runtime to container name | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
The use case I have in mind is to run Node 16.x Lambdas - the default container registry is `lambci/lambda` which is effectively abandoned. [Not even Node 14.x has been published](https://github.com/lambci/docker-lambda/pull/330). However, switching the registry over to [`amazon/aws-lambda-nodejs`](https://hub.docker.com/r/amazon/aws-lambda-nodejs) still fails to pull the container, since localstack is looking for the tag `nodejs16.x`. I'd like to be able to specify that if the runtime is `nodejs16.x` it just looks for tag `16`.
### 🧑💻 Implementation
_No response_
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6111 | https://github.com/localstack/localstack/pull/6200 | 34dff608860d710a9dcb3ad0b487d0fd15295648 | 270672429c64ebcbceecf84f633aaf6be7839df9 | 2022-05-20T21:00:58Z | python | 2022-06-29T13:46:01Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,107 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | bug: SQS reports that "MessageGroupId" is required when it is not | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When calling `ReceiveMessage` on a FIFO queue, I _sometimes_ get HTTP 400 with the message:
```
[Aws\Sqs\Exception\SqsException]
Error executing "ReceiveMessage" on "http://localhost:4566/queue/us-west-2/000000000000/commands.fifo"; AWS HTTP error: Client er
ror: `POST http://localhost:4566/queue/us-west-2/000000000000/commands.fifo` resulted in a `400 Bad Request` response:
<?xml version='1.0' encoding='utf-8'?>
<ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Code>Mi (truncated...)
MissingParameter (client): The request must contain the parameter MessageGroupId. - <?xml version='1.0' encoding='utf-8'?>
<ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Code>MissingParameter</Code><Message>The request must c
ontain the parameter MessageGroupId.</Message><Type>Sender</Type></Error><RequestId>88L3LXATEGVS0JF5S9BZDEQA95ELASZCKL4EJM5NCX9Y3
DHMP2RK</RequestId></ErrorResponse>
```
There doesn't seem to be a particular pattern to it, and restarting localstack makes it go away.
### Expected Behavior
`RecieveMessage` should never require a `MessageGroupId` parameter, because such a parameter [does not exist][1].
[1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```
docker compose up -d
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
My calling code is (PHP SDK):
```php
$options = [
'QueueUrl' => $this->config->url,
'WaitTimeSeconds' => 4,
'MaxNumberOfMessages' => 10,
'VisibilityTimeout' => 10,
];
$result = $this->client->receiveMessage($options);
```
### Environment
```markdown
- OS: Mac OS 12.3
- LocalStack: 0.14.3
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6107 | https://github.com/localstack/localstack/pull/6115 | 308ee11005d0b3d9ad90e1d3a3cf14e532391098 | e2618605481e3c059e15587c34a311b7b482cfe9 | 2022-05-20T14:39:16Z | python | 2022-05-21T16:50:21Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,096 | ["localstack/services/apigateway/helpers.py", "localstack/services/awslambda/event_source_listeners/sqs_event_source_listener.py", "localstack/services/awslambda/event_source_listeners/stream_event_source_listener.py", "localstack/services/awslambda/lambda_api.py", "localstack/services/awslambda/lambda_utils.py", "localstack/testing/pytest/fixtures.py", "tests/integration/awslambda/test_lambda_integration.py", "tests/integration/cloudformation/test_cloudformation_lambda.py", "tests/integration/templates/lambda_dynamodb_filtering.yaml"] | feature request: Support Lambda filtering on DynamoDB | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
Basically we want to only run the lambda when an insert is occurring in DynamoDB.
I tested using Dynobase deleting a record and the lambda still triggered.
```
resource "aws_lambda_event_source_mapping" "event-log" {
event_source_arn = aws_dynamodb_table.event-log.stream_arn
function_name = module.main.lambda-arn
starting_position = "LATEST"
enabled = true # change to false when truncating the table in localstack
maximum_retry_attempts = 1 # limit retry on failure to 1 for now
# https://dev.to/aws-builders/filtering-dynamodb-streams-before-lambda-p5p
filter_criteria { # Doesn't seem to work on LocalStack for now
filter {
pattern = jsonencode({
body = {
eventName : ["INSERT"]
}
})
}
}
}
```
### 🧑💻 Implementation
_No response_
### Anything else?
https://dev.to/aws-builders/filtering-dynamodb-streams-before-lambda-p5p | https://github.com/localstack/localstack/issues/6096 | https://github.com/localstack/localstack/pull/6212 | e7598134fad9e628d93096d5a53e4d3db43c21fb | 2a9be8c4dc3b7193c8c56232c910535ee56a2945 | 2022-05-19T14:58:22Z | python | 2022-08-23T13:37:57Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,056 | [".circleci/config.yml", "localstack/services/dynamodb/provider.py", "localstack/utils/aws/aws_stack.py", "tests/integration/test_error_injection.py"] | LocalStack DYNAMODB_WRITE_ERROR_PROBABILITY | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
After configuring it withEnv("DYNAMODB_WRITE_ERROR_PROBABILITY", "1.0") — it is expected to throw dynamo throuput exception , but throwing 500 error - `(Service: DynamoDb, Status Code: 500, Request ID: null, Extended Request ID: null)","operationType":"PutItem","kinesisRecordMetaData":{"recordInsertionDate":"01-01-2021"}}, Response - PutObjectResponse(ETag="5435b0664a1337227d380fbd83ebcc89")
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6056 | https://github.com/localstack/localstack/pull/6063 | 0a4359f13c51761713d6a5ea1ebd6ac962394443 | c55ce9eca151c0f90b7cc60a2040eb3d6ffab262 | 2022-05-13T03:34:36Z | python | 2022-05-14T14:57:12Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,044 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | bug: SQS client crashes if malformed request | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When sending a "malformed" request (and empty string in a MessageAttribute) the SQS client crashes with:
```
SerializationError: failed to unmarshal error message
status code: 500, request id:
caused by: UnmarshalError: failed to unmarshal error message
00000000 3c 21 64 6f 63 74 79 70 65 20 68 74 6d 6c 3e 0a |<!doctype html>.|
00000010 3c 68 74 6d 6c 20 6c 61 6e 67 3d 65 6e 3e 0a 3c |<html lang=en>.<|
00000020 74 69 74 6c 65 3e 35 30 30 20 49 6e 74 65 72 6e |title>500 Intern|
00000030 61 6c 20 53 65 72 76 65 72 20 45 72 72 6f 72 3c |al Server Error<|
00000040 2f 74 69 74 6c 65 3e 0a 3c 68 31 3e 49 6e 74 65 |/title>.<h1>Inte|
00000050 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 6f |rnal Server Erro|
00000060 72 3c 2f 68 31 3e 0a 3c 70 3e 54 68 65 20 73 65 |r</h1>.<p>The se|
00000070 72 76 65 72 20 65 6e 63 6f 75 6e 74 65 72 65 64 |rver encountered|
00000080 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 65 72 72 | an internal err|
00000090 6f 72 20 61 6e 64 20 77 61 73 20 75 6e 61 62 6c |or and was unabl|
000000a0 65 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 79 6f |e to complete yo|
000000b0 75 72 20 72 65 71 75 65 73 74 2e 20 45 69 74 68 |ur request. Eith|
000000c0 65 72 20 74 68 65 20 73 65 72 76 65 72 20 69 73 |er the server is|
000000d0 20 6f 76 65 72 6c 6f 61 64 65 64 20 6f 72 20 74 | overloaded or t|
000000e0 68 65 72 65 20 69 73 20 61 6e 20 65 72 72 6f 72 |here is an error|
000000f0 20 69 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 | in the applicat|
00000100 69 6f 6e 2e 3c 2f 70 3e 0a |ion.</p>.|
caused by: XML syntax error on line 2: unquoted or missing attribute value in element
```
### Expected Behavior
When (trying to) sending the same message on a "real" AWS SQS queue, this is the error message:
```
InvalidParameterValue: Message (user) attribute 'ErrorDetails' must contain a non-empty value of type 'String'.
status code: 400, request id: db2719d5-7bd3-5aa0-af81-43203661447a
```
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
Dockercompose.yaml (snippet)
```
localstack:
container_name: "aws-sqs"
image: "localstack/localstack:latest"
hostname: aws-sqs
environment:
- AWS_REGION=us-west-2
- EDGE_PORT=4566
- SERVICES=sqs
ports:
- '4566:4566'
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
- backend
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
aws --endpoint-url=http://localhost:4566 --region us-west-2 sqs create-queue --queue-name events
### Environment
```markdown
- OS: Ubuntu 22.04
- LocalStack: localstack/localstack:latest
- Go: go version go1.18 linux/amd64
```
### Anything else?
[Go Statemachine](https://github.com/massenz/go-statemachine)
Currently in a dev branch: `statemachine-sqs` | https://github.com/localstack/localstack/issues/6044 | https://github.com/localstack/localstack/pull/6090 | 5745e328fc1fe5f79e2bee2c7fb65f280cce48c5 | e2ec88f027a4e246753a243911e32c0f54c2f9c1 | 2022-05-11T06:11:28Z | python | 2022-05-19T09:53:23Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,022 | ["localstack/services/awslambda/lambda_api.py"] | question: Can't use apigateway lambda with chalice-local and localstack | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
Problem when following chalice tutorial with chalice-local and localstack:
https://aws.github.io/chalice/quickstart.html
```
DEBUG=1 localstack start
chalice-local new-project hello
cd hello/
chalice-local deploy
/home/raul/git_repos/provider-manager/venv/lib/python3.9/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Creating deployment package.
Creating IAM role: hello-dev
Creating lambda function: hello-dev
Creating Rest API
Resources deployed:
- Lambda ARN: arn:aws:lambda:us-east-1:000000000000:function:hello-dev
- Rest API URL: https://4yr9k2ce77.execute-api.us-east-1.amazonaws.com/api/
(venv) raul:~/.../provider-manager/hello (master) $ http http://localhost:4566/restapis/4yr9k2ce77/api/_user_request_/
HTTP/1.1 500
Access-Control-Allow-Headers: authorization,cache-control,content-length,content-md5,content-type,etag,location,x-amz-acl,x-amz-content-sha256,x-amz-date,x-amz-request-id,x-amz-security-token,x-amz-tagging,x-amz-target,x-amz-user-agent,x-amz-version-id,x-amzn-requestid,x-localstack-target,amz-sdk-invocation-id,amz-sdk-request
Access-Control-Allow-Methods: HEAD,GET,PUT,POST,DELETE,OPTIONS,PATCH
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: etag,x-amz-version-id
Connection: close
Content-Length: 462
Content-Type: text/html; charset=utf-8
date: Fri, 06 May 2022 15:47:55 GMT
server: hypercorn-h11
{
"errorMessage": "'stageVariables'",
"errorType": "KeyError",
"stackTrace": [
" File \"/var/task/chalice/app.py\", line 1238, in __call__\n self.current_request = handler.create_request_object(event, context)\n",
" File \"/var/task/chalice/app.py\", line 1660, in create_request_object\n self.current_request = Request(event, context)\n",
" File \"/var/task/chalice/app.py\", line 406, in __init__\n self.stage_vars = event_dict['stageVariables']\n"
]
}
```
```
(venv) raul:~/.../provider-manager/hello (master) $ chalice --version
chalice 1.27.0, python 3.9.12, linux 5.15.0-27-generic
(venv) raul:~/.../provider-manager/hello (master) $ localstack --version
0.14.2.8
(venv) raul:~/.../provider-manager/hello (master) $
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6022 | https://github.com/localstack/localstack/pull/6042 | 2080d292bd27816dc67b35c5ec58eb1272be40d7 | f507e1e228f4365d9b35db1f02f6099613354ccb | 2022-05-06T15:55:48Z | python | 2022-05-11T06:17:26Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 6,021 | ["Makefile", "bin/lambda/Dockerfile.nodejs14x", "localstack/contrib/thundra.py", "localstack/services/awslambda/lambda_executors.py", "localstack/services/awslambda/lambda_utils.py", "tests/integration/awslambda/test_lambda.py", "tests/integration/awslambda/test_lambda.snapshot.json"] | bug: Lambda won't execute if using ES6 export syntax | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When running a lambda using E6S export syntax:
```
export const handler = (event) => {
console.log("hello world");
console.log(event);
return event;
};
```
with `"type": "module"` set in my `package.json` I get the following error:
```
ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Must use import to load ES Module: /var/task/index.js\nrequire() of ES modules is not supported.\nrequire() of /var/task/index.js from /var/runtime/UserFunction.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.\nInstead rename index.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /var/task/package.json.\n","code":"ERR_REQUIRE_ESM","stack":["Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/task/index.js","require() of ES modules is not supported.","require() of /var/task/index.js from /var/runtime/UserFunction.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.","Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /var/task/package.json.",""," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1063:30)"]}
```
I have provisioned the lambda with terraform:
```
resource "aws_lambda_function" "test" {
filename = "lambda.zip"
function_name = "test-function"
role = aws_iam_role.lambda.arn
handler = "index.handler"
source_code_hash = data.archive_file.lambda_my_function.output_base64sha256
runtime = "nodejs14.x"
}
```
### Expected Behavior
I'd expect the lambda to execute successfully without any errors.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
docker compose up with example docker-compose.yaml file:
```
version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack
network_mode: bridge
ports:
- "127.0.0.1:53:53" # only required for Pro (DNS)
- "127.0.0.1:53:53/udp" # only required for Pro (DNS)
- "127.0.0.1:443:443" # only required for Pro (LocalStack HTTPS Edge Proxy)
- "127.0.0.1:4510-4559:4510-4559" # external service port range
- "127.0.0.1:4566:4566" # LocalStack Edge Proxy
environment:
- DEBUG=${DEBUG-}
- DATA_DIR=${DATA_DIR-}
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-}
- LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY-} # only required for Pro
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
```
Infrastructure is provisioned with the terraform in the example above. The code runs fine when using CommonJS.
Lambda is triggered with the following command:
```
awslocal lambda invoke --function-name test-function --invocation-type Event --cli-binary-format raw-in-base64-out --payload '{ "key": "value" }' output.txt
```
### Environment
```markdown
- OS: macOS Mojave 10.14.6 (18G9216)
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/6021 | https://github.com/localstack/localstack/pull/6200 | 34dff608860d710a9dcb3ad0b487d0fd15295648 | 270672429c64ebcbceecf84f633aaf6be7839df9 | 2022-05-06T15:42:18Z | python | 2022-06-29T13:46:01Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,988 | ["localstack/services/apigateway/integration.py", "localstack/utils/aws/templating.py", "tests/unit/test_apigateway.py", "tests/unit/test_templating.py"] | bug: AppSync velocity resolvers #return macro unsupported | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
`#return` macro for AppSync is not supported
```
- ["Error in template '<string>' at position 48-60 in expression: #return($v1)\nException: no such macro: return\n\nGraphQL request:3:11\n2 | {\n3 | hi2 {\n | ^\n4 | value"] None
```
### Expected Behavior
`#return` is a valid command in AppSync Resolver Velocity request and response templates.
https://docs.aws.amazon.com/appsync/latest/devguide/aws-appsync-directives.html
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
localstack start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
1. `CDKDeployment`
2. GraphQL Rest API to `localstack`
3. AppSync resolver with response template:
```vtl
#set($v1 = {})
$util.qr($v1.put('value', 'hi'))
#return($v1)"
```
```sdl
schema {
query: Query
}
type valueObj {
value: String
}
type Query {
hi2: valueObj
}
```
4. Query AppSync
```sdl
Query {
hi2
}
```
### Environment
```markdown
- OS: Ubuntu/WSL2
- LocalStack: 0.14.2.1
```
### Anything else?
The same code runs fine on AWS/AppSync. | https://github.com/localstack/localstack/issues/5988 | https://github.com/localstack/localstack/pull/6035 | 1d6d83408b172f626d0653031e2470c1c1993ba3 | 4ec0bbe09215191e46df96affbb87ae61f3f71fc | 2022-05-02T20:14:37Z | python | 2022-05-10T19:45:58Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,942 | ["localstack/services/apigateway/helpers.py", "localstack/services/awslambda/event_source_listeners/sqs_event_source_listener.py", "localstack/services/awslambda/event_source_listeners/stream_event_source_listener.py", "localstack/services/awslambda/lambda_api.py", "localstack/services/awslambda/lambda_utils.py", "localstack/testing/pytest/fixtures.py", "tests/integration/awslambda/test_lambda_integration.py", "tests/integration/cloudformation/test_cloudformation_lambda.py", "tests/integration/templates/lambda_dynamodb_filtering.yaml"] | feature request: implement --filter-criteria for lambda event source mappings | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
AWS has a feature which allows you to [filter incoming lambda invocations using rules](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html). Without this feature I need to filter inside the lambda code itself which will incur more compute and cost in AWS. In the spirit of having as few diffs between localstack and AWS this is highly desireable for my pipeline.
(And fwiw, my pipeline is DynamoDB -> DynamoDB Stream -> Lambda (Python) -> Opensearch)
The current behavior is that create/update-event-source-mapping does parse (and validate) this option, but it isn't honored against incoming events at runtime.
### 🧑💻 Implementation
Implement with the same logic as AWS with support for all the operators in the linked article above.
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5942 | https://github.com/localstack/localstack/pull/6212 | e7598134fad9e628d93096d5a53e4d3db43c21fb | 2a9be8c4dc3b7193c8c56232c910535ee56a2945 | 2022-04-27T16:41:49Z | python | 2022-08-23T13:37:57Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,916 | ["localstack/services/dynamodb/provider.py", "tests/integration/test_dynamodb.py"] | bug: Response object TableDescription contains a member which is not specified: TableClass | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
> ERROR:localstack.aws.protocol.serializer: Response object TableDescription contains a member which is not specified: TableClass
>
> Traceback (most recent call last):
>
> File "/opt/code/localstack/localstack/aws/protocol/serializer.py", line 1007, in _serialize_type_structure
>
> member_shape = members[member_key]
>
> KeyError: 'TableClass'
### Expected Behavior
_No response_
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
Create a DynamoDB table via Pulumi.
### Environment
```markdown
- OS: Mac M1
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5916 | https://github.com/localstack/localstack/pull/5923 | 386781e75cfbbf7ffa0fec4ebdc73c7e4ae6d763 | 2aa079a74a4b2904190c229635dd6b2e9b1d508c | 2022-04-22T09:19:21Z | python | 2022-04-25T08:58:16Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,908 | ["localstack/services/dynamodb/provider.py", "tests/integration/test_dynamodb.py"] | bug: DynamoDB TransactGetItems always returns ResourceNotFoundException | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
* Create any table with any records
* Do a TransactGetItems on the table
* Localstack returns
```
ResourceNotFoundException: Cannot do operations on a non-existent table
```
### Expected Behavior
TransactGetItems should succeed.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```
docker-compose up
```
`docker-compose.yml`
```
version: '3'
services:
localstack:
image: localstack/localstack
environment:
- DEFAULT_REGION=eu-west-2
- SERVICES=dynamodb
- DOCKER_HOST=unix:///var/run/docker.sock
ports:
- 4566:4566
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```
#! /bin/bash
aws --endpoint-url=http://localhost:4566 dynamodb create-table --attribute-definitions AttributeName=forumId,AttributeType=S --table-name forum --key-schema AttributeName=forumId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 > /dev/null
aws --endpoint-url=http://localhost:4566 dynamodb put-item --table-name forum --item '{"forumId": {"S": "forum001"}, "data": {"S": "helloworld"}}' > /dev/null
aws --endpoint-url=http://localhost:4566 dynamodb get-item --table-name forum --key '{"forumId": {"S": "forum001"}}' > /dev/null
# This one fails
aws --endpoint-url=http://localhost:4566 dynamodb transact-get-items --transact-items '[{"Get": {"Key":{"forumId": {"S": "forum001"}}, "TableName": "forum"}}]' > /dev/null
```
### Environment
```markdown
- OS: MacOS 10.15.7
- LocalStack: latest, digest 843db39ff1df83fd537e15b30e39d6fb8c3590efd6bf3f6f96b1734418fbd19f
```
### Anything else?
This works in `localstack/localstack:0.14.1` | https://github.com/localstack/localstack/issues/5908 | https://github.com/localstack/localstack/pull/5909 | dac13f5d8206e405e660942dbca0507dd22576d4 | 5a89c292c10e61943779cc2254ab43aa808c36b5 | 2022-04-21T14:58:03Z | python | 2022-04-21T17:06:30Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,890 | ["localstack/services/sqs/sqs_listener.py", "tests/integration/test_sqs.py"] | bug: SQS Fifo does not work (version 0.14.2) | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I'm on an M1 mac. I had a queue with the same name as the following, but it was not a FIFO queue, so I deleted it and recreated. Although it let me create the queue, it didn't exist when I went to the URL.
So I upgraded from an older version of localstack thinking that might be the problem, however this still doesn't work.
```
awslocal sqs create-queue --queue-name us-east-1-dev-recorder-request.fifo --attributes FifoQueue=true
{
"QueueUrl": "http://localhost:4566/000000000000/us-east-1-dev-recorder-request.fifo"
}
```
This appears to work and the url shows up when running list-queues, however going to the URL shows "no such bucket"
```
awslocal --endpoint-url=http://localhost:4566 sqs create-queue --queue-name bleebloo
```
This does work however without making a Fifo queue. Am I doing something wrong? This seems like it should work fine. I've tried using different names, but no fifo queues work.
### Expected Behavior
`awslocal sqs create-queue --queue-name us-east-1-dev-recorder-request.fifo --attributes FifoQueue=true`
This should create a queue that can be accessed at the returned URL.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
```
services:
localstack:
image: localstack/localstack:0.14.2
ports:
- "4566:4566"
environment:
SERVICES: s3,sqs
DATA_DIR: /tmp/localstack/data
DOCKER_HOST: unix:///var/run/docker.sock
volumes:
- "./tmp/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
`awslocal sqs create-queue --queue-name us-east-1-dev-recorder-request.fifo --attributes FifoQueue=true`
### Environment
```markdown
- OS: macOS Monteray 12.0.1
- LocalStack: 0.14.2
```
### Anything else?
http://localhost:4566/000000000000/test.fifo
For example after creating a test.fifo queue:
```
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>000000000000</BucketName>
<RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>
</Error>
``` | https://github.com/localstack/localstack/issues/5890 | https://github.com/localstack/localstack/pull/5892 | d8ea2a425a6a9eff16a3ed4e553be764e1eaf803 | f7a9bf8846c3e6e1f767597ef3e94f93e6e5f674 | 2022-04-19T00:53:14Z | python | 2022-04-20T11:42:32Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,843 | ["localstack/services/dynamodb/provider.py", "tests/integration/test_dynamodb.py"] | bug: DynamoDB ResourceNotFoundException when performing BatchGetItem | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I am receiving a ResourceNotFoundException when attempting to run a BatchGetItem operation on a table that exists. Downgrading to `0.14.2` fixes the issue and I was not receiving this issue on Friday when running the `latest` container. I am able to run `scan` and `query` requests successfully on these tables.
### Expected Behavior
BatchGetItem should work on tables that exist
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run localstack/localstack
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
- `awslocal dynamodb create-table --table-name test-table --attribute-definitions AttributeName=PK,AttributeType=S --key-schema AttributeName=PK,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1`
- `awslocal dynamodb list-tables`
```
{
"TableNames": [
"test-table"
]
}
```
- `awslocal dynamodb batch-get-item --request-items '{ "test-table": { "Keys": [{ "PK": {"S": "test-key"} }] } }'`
```
An error occurred (ResourceNotFoundException) when calling the BatchGetItem operation: Cannot do operations on a non-existent table
```
### Environment
```markdown
- OS:
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5843 | https://github.com/localstack/localstack/pull/5848 | 67fddeb0e4792df58f8b61a85851b8502324015e | 95b53bca4567f1b99b3d8392c12e1030b3259480 | 2022-04-11T18:26:06Z | python | 2022-04-12T18:29:21Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,835 | ["localstack/services/edge.py", "localstack/utils/urls.py"] | bug: Referer header is not consistent across resource methods (apigateway) | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Reproducible with https://github.com/localstack/localstack-terraform-samples/tree/master/apigatewayv2-http-referer-header
Describe here https://github.com/localstack/localstack/issues/5833
### Expected Behavior
Use of the `Referer` header should be consistent across method resources.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run localstack/localstack
Run the example https://github.com/localstack/localstack-terraform-samples/tree/master/apigatewayv2-http-referer-header
### Environment
```markdown
- OS:
- LocalStack:
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5835 | https://github.com/localstack/localstack/pull/5839 | 9286deba40358de1bcb4d8f9cdb9f684511a09a3 | c4930f47a40b83188b66c279735382e713b719b3 | 2022-04-09T16:40:40Z | python | 2022-04-14T16:25:08Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,831 | ["localstack/services/dynamodb/provider.py", "tests/integration/test_dynamodb.py"] | bug: DynamoDb local secondary index not found | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When using the latest docker image, if we define a local secondary index for a dynamodb table and query it, localstack fails with `Index Not Found`
This behaviour is not seen in the previous version of the docker image 0.14.2. I believe this was introduced in a recent change from https://github.com/localstack/localstack/pull/5799
### Expected Behavior
Querying local secondary index should be supported like it previously was
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose.yml
```
services:
localstack:
image: localstack/localstack:latest
ports:
- "443:443"
- "4566:4566"
- "4571:4571"
environment:
- SERVICES=dynamodb,cloudformation
- DEFAULT_REGION=eu-west-1
- START_WEB=false
```
cloudformation-template.yml
```
AWSTemplateFormatVersion: "2010-09-09"
Resources:
DomainTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: "PK"
AttributeType: "S"
- AttributeName: "SK"
AttributeType: "S"
- AttributeName: "LSI1SK"
AttributeType: "N"
BillingMode: "PAY_PER_REQUEST"
KeySchema:
- AttributeName: "PK"
KeyType: "HASH"
- AttributeName: "SK"
KeyType: "RANGE"
LocalSecondaryIndexes:
- IndexName: "LSI1"
KeySchema:
- AttributeName: "PK"
KeyType: "HASH"
- AttributeName: "LSI1SK"
KeyType: "RANGE"
Projection:
ProjectionType: "ALL"
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
TableName: "<omitted>"
Tags:
- Key: "Name"
Value: "<omitted>"
TimeToLiveSpecification:
AttributeName: "LastTimestamp"
Enabled: true
```
docker compose up
### Environment
```markdown
- OS: docker
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5831 | https://github.com/localstack/localstack/pull/5847 | 0a1e93e1e83ac48aa9b8f4c5adab862cd086e925 | dc25fb65bb5fb3dc3dcc3950a32ca55d90daec5a | 2022-04-08T06:47:49Z | python | 2022-04-13T07:34:06Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,820 | ["localstack/cli/localstack.py"] | feature request: Surface expired or missing API key via `localstack wait` | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
Originally raised [on Slack](https://localstack-community.slack.com/archives/CMAFN2KSP/p1649264485098269).
Our GH Actions started [timing out](https://localstack-community.slack.com/archives/CMAFN2KSP/p1649264485098269) one day on our `localstack start -d ; localstack wait …` command (per the [recommended instructions](https://docs.localstack.cloud/ci/github-actions/)). We couldn't figure out what was going on. It turns out that we had an expired API key, but didn't know it. The problem is that LocalStack appears to endlessly loop on startup when it encounters a stale API key. This makes it _look_ like `localstack wait …` is timing out, but that hides the true problem.
Ideally, LocalStack should fail immediately under these circumstances and the problem should be surfaced in logs visible via GitHub's actions interface.
### 🧑💻 Implementation
One idea:
1. Cause LocalStack to fail immediately when the API key expired and when pro services are requested.
2. Augment the [recommended instructions](https://docs.localstack.cloud/ci/github-actions/) to surface the problem if LocalStack fails to start up. I don't know if this would work:
``` sh
localstack wait -t 30 || ( localstack logs && exit 1 ) # <-- wait up to 30 seconds and then dump logs if wait fails
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5820 | https://github.com/localstack/localstack/pull/6477 | e105e4880583b573287ca9e36d78b385eac227c8 | 4967399f262d49cac7f83608cdd6d13c91f602d6 | 2022-04-06T17:21:48Z | python | 2022-07-21T14:35:03Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,792 | ["localstack/services/providers.py"] | bug: KMS_PROVIDER=local-kms not honored | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When updating from 0.14.1 to 0.14.2 it appears that the `KMS_PROVIDER` environment variable is no longer honored, and `local-kms` is not used.
### Expected Behavior
Setting `KMS_PROVIDER=local-kms` and using the KMS service should launch `local-kms` as it did previously.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run -e KMS_PROVIDER=local-kms localstack/localstack:0.14.1
docker run -e KMS_PROVIDER=local-kms localstack/localstack:0.14.2
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
##### 0.14.1
awslocal kms list-keys
# {
# "Keys": []
# }
ps x|grep kms
# 164 ? Ss 0:00 /bin/sh -c /opt/code/localstack/localstack/infra/kms/local-kms.linux-arm64.bin
# 165 ? Sl 0:00 /opt/code/localstack/localstack/infra/kms/local-kms.linux-arm64.bin
# 179 pts/0 S+ 0:00 grep kms
##### 0.14.2
awslocal kms list-keys
# {
# "Keys": []
# }
ps x|grep kms
# 151 pts/0 S+ 0:00 grep kms
### Environment
```markdown
- OS: macOS 12.3
- LocalStack: 0.14.2
- Docker: 20.10.13, build a224086
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5792 | https://github.com/localstack/localstack/pull/5793 | 7af8ed9f84b8e603b5af6db2c5647dd65c701c90 | 0f356a6024c4514d2f8f5942baf0a08098e18520 | 2022-04-01T17:58:31Z | python | 2022-04-01T18:59:50Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,784 | ["localstack/config.py"] | DYNAMODB_SHARE_DB is not passed to container when LocalStack started with CLI | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
The documentation states that when setting DYNAMODB_SHARE_DB=1 DynamodDB will use a single database for each credential and region. This doesn't work when LocalStack is started from CLI. For example:
`DYNAMODB_SHARE_DB=1 localstack start -d`
In Docker logs you can find:
INFO:localstack.services.dynamodb.server: SharedDb: false
At least it seems that the environment variable is missing from CONFIG_ENV_VARS which is used for passing the environment variables to container.
Tried the following fix and at least after brief testing it solves the issue:
https://github.com/jvuori/localstack/commit/6bb4a3c68c8675b9548e0f5eb8028397d9ee5a47
Feel free to pull if the fix is appropriate. (Sorry, no unit test...)
### Expected Behavior
`DYNAMODB_SHARE_DB=1 localstack start -d`
should start DynamoDB with:
INFO:localstack.services.dynamodb.server: SharedDb: true
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
DYNAMODB_SHARE_DB=1 localstack start -d
### Environment
```markdown
- OS: Windows + WSL2 + Docker CE running inside WSL2
- LocalStack: 0.14.1
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5784 | https://github.com/localstack/localstack/pull/5842 | d2ffa1fbfa0f9e869b4fcdc209247a79988e433a | ef92370b797ad9074c53cfb2c92bd1481ebfb40d | 2022-03-31T22:02:01Z | python | 2022-04-11T17:14:14Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,780 | ["localstack/constants.py", "localstack/services/apigateway/apigateway_listener.py", "localstack/services/edge.py", "localstack/services/generic_proxy.py"] | bug: use custom header instead of Authorisation for routing and region detection | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
We are using the `Authorization` header for routing purposes
```
"authorization: AWS4-HMAC-SHA256 <...>"
```
https://github.com/localstack/localstack/issues/5770
### Expected Behavior
Use a custom header to avoid causing confusion with backend integrations
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
Run a custom HTTP integration without authorisation
### Environment
```markdown
- OS:
- LocalStack:
```
### Anything else?
No | https://github.com/localstack/localstack/issues/5780 | https://github.com/localstack/localstack/pull/5809 | cb15d705a26592bba7de0c78ef55e3ec47e398a8 | c9afb54109f6df150135da7506e6875e82937571 | 2022-03-31T10:05:27Z | python | 2022-04-07T07:27:19Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,749 | ["Dockerfile"] | bug: TLS Handshake Failure | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When making a curl call to against localstack in a container, it causes localstack to die and restart.
I am using a Mac M1 that has been upgraded to Monterey 12.3.
From what I can tell, this is related to the security cipher that curl uses, as the browser works correct, and I can get it to work correctly if I force a specific cipher that matches the browser. ie
`curl -v -k --ciphers TLS_AES_256_GCM_SHA384 https://localhost:4566/health`
### Expected Behavior
The localstack service should not crash and restart.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
I am using the default docker-compose in the master branch.
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose up -d
#### Steps to reproduce:
- Clone localstack project locally
- Run `docker-compose up -d`
- run this command `curl -v -k https://localhost:4566/health`
Expected: A response would be returned with the service health.
Actual:
```
* Trying 127.0.0.1:4566...
* Connected to localhost (127.0.0.1) port 4566 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:4566
* Closing connection 0
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:4566
```
Important Note: Visiting it in the browser is successful. Also, forcing the cipher is successful.
### Environment
```markdown
- OS: MacOS Monterey 12.3
- LocalStack: latest
- curl --version
curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.5 zlib/1.2.11 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
```
```
### Anything else?
I spent the day attempting to debug this directly in the container to find the root of the issue. However, it appears to die before the request ever even makes it to the localstack python code (as that's where I was debugging). I wasn't sure where to troubleshoot further or find logs additional logs. The only info that shows up in the localstack logs is this:
```
2022-03-24 13:26:41,955 INFO exited: infra (terminated by SIGSEGV; not expected)
2022-03-24 13:26:42,969 INFO spawned: 'infra' with pid 5130
```
If you need more troubleshooting info, please let me know. | https://github.com/localstack/localstack/issues/5749 | https://github.com/localstack/localstack/pull/5856 | 2d62321e3ad783693992ac338bf1ac8ee1cc15b8 | ccf8c3bd54b8420225cc2cb4d6d4896834b48686 | 2022-03-25T12:42:17Z | python | 2022-04-13T14:37:14Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,716 | ["localstack/aws/api/kms/__init__.py", "localstack/aws/protocol/serializer.py", "localstack/config.py", "localstack/services/cloudformation/models/kms.py", "localstack/services/dynamodb/dynamodb_listener.py", "localstack/services/kms/kms_listener.py", "localstack/services/kms/kms_starter.py", "localstack/services/kms/provider.py", "localstack/services/providers.py"] | bug: KMS Sign returns Unknown Error when using Lambda Containers | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When attempting to sign some document using Localstack KMS inside a lambda container (also running on localstack), the localstack KMS listener returns some unknown error.
The KMS key and lambda containers have been created from the same CDK app deploy, and I can see all the resources in the localstack web console.
The test application I'm using to prove this behaviour is available here:
https://github.com/LukaHedt/localstack_kms_test
Instructions to run are in the main Readme, and the `/localstack/Readme.md` file.
`aws-sdk` returns an unknown error, and the localstack docker logs that I receive are available here:
https://pastebin.com/58Z3fXi3
Have done an amount of testing and can confidently claim the following:
- Have tested on multiple machines with the same outcome
- Doesn’t make a difference if I specify an ARN or a KeyID in the signing request
- Downgrading localstack versions either didn’t make a difference, or I couldn’t actually deploy a localstack container with version 0.12.20 or lower.
### Expected Behavior
KMS Sign should return a signature for the given payload.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
Test application demonstrating the current behaviour is available here:
https://github.com/LukaHedt/localstack_kms_test
Full instructions to run are in the `/localstack/Readme.md` file.
### Environment
```markdown
- OS: MacOS Monteray 12.3
- LocalStack: 0.14.0
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5716 | https://github.com/localstack/localstack/pull/5725 | 52d7d1e589a7d7e1b49db27ffcc9ba929fdd43c2 | 70958beb42bbf3d686dbf4453618618b6705879a | 2022-03-22T01:07:23Z | python | 2022-03-22T21:58:50Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,692 | ["localstack/services/cloudformation/models/sqs.py", "tests/integration/cloudformation/test_cloudformation_sqs.py", "tests/integration/templates/sqs_fifo_autogenerate_name.yaml"] | bug: sqs creation breaks with 0.14.1 | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Having the following cdk definition for a sqs queue
const queue = new sqs.Queue(scope, `foo-queue`, {
fifo: true,
visibilityTimeout: Duration.seconds(300),
contentBasedDeduplication: true
})
deploy works normally with localstack 0.14.0 using https://github.com/localstack/aws-cdk-local
But after upgrading to 0.14.1 we see the following error
2022-03-17T11:34:23.851:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.SQS object at 0x7f11db7346d0>> with params: {'QueueName': 'FooStack-fooqueueB0475DE4-8bf04fb7', 'Attributes': {'ContentBasedDeduplication': 'True', 'FifoQueue': 'True', 'VisibilityTimeout': '300'}, 'tags': {}} for resource: {'Type': 'AWS::SQS::Queue', 'UpdateReplacePolicy': 'Delete', 'DeletionPolicy': 'Delete', 'Metadata': {'aws:cdk:path': 'FooStack/foo-queue/Resource'}, 'LogicalResourceId': 'fooqueueB0475DE4', 'Properties': {'ContentBasedDeduplication': True, 'FifoQueue': True, 'VisibilityTimeout': 300, 'QueueName': 'FooStack-fooqueueB0475DE4-8bf04fb7'}, '_state_': {}}
Only difference being the localstack upgrade, downgrading back to 0.14.0 fixes the problem.
### Expected Behavior
Sqs queue is created successfully like with 0.14.0
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
cdklocal deploy
### Environment
```markdown
- LocalStack: 0.14.1
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5692 | https://github.com/localstack/localstack/pull/5700 | 6a6f38fb5f1cdce2bc60fdbd9f3f0e2b4e458dbf | bffe95e6f2d41c9c1882a23791014a75fe399f42 | 2022-03-17T11:45:07Z | python | 2022-03-19T09:14:54Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,689 | ["localstack/services/apigateway/apigateway_listener.py"] | UnicodeDecodeError after Lambda handling | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
Hello,
I am new in localstack and AWS too. I created AWS Lambda handler, which is integrated with APIGateway. This handler accepts multipart/form-data, because request has to have image in it. If request has all required data in right form and right values, which refer to some data in DynamoDB, then everything is fine, lambda returns response with 200 status code. When data are not in right form, Lambda returns response with 400 status code, but still nothing crashes. But when values stated above are not valid, specifically that values refer to other items in database, which do not exist, my lambda finds that out and returns response with 404 status code and error message in JSON form (Content-Type in header is set to JSON too). After that I see in localstack logs my "Not Found" response, so i assume that lambda successfully handled request, but then there is UnicodeDecodeError, which you can see on image. When I changed status code from 404 to 200 or even 403, I didn't get that error. What am I doing wrong?
Thank you.

### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5689 | https://github.com/localstack/localstack/pull/5721 | fca4df72170343f2c78dad08a49fc5f3c15df099 | f0a574cfd6030e42c6cd9446fd977bd46ad00593 | 2022-03-16T22:25:12Z | python | 2022-03-22T16:24:25Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,674 | ["localstack/services/awslambda/lambda_utils.py", "localstack/services/cloudformation/deployment_utils.py", "localstack/services/cloudformation/models/apigateway.py", "localstack/utils/cloudformation/template_deployer.py", "tests/integration/templates/apigateway_integration.json", "tests/unit/test_cloudformation.py"] | bug: CloudFormation resource AWS::ApiGateway::UsagePlan stuck in UPDATE_IN_PROGRESS | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I create a CloudFormation stack with an `AWS::ApiGateway::UsagePlan` resource, but that resource is stuck in `UPDATE_IN_PROGRESS`.
And the resource hasn't been created:
```
> aws --endpoint-url=http://localhost:4566 apigateway get-usage-plans
{
"items": []
}
```
### Expected Behavior
A UsagePlan is created. I need this, so I can attach an API Key to it.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
> $env:LOCALSTACK_API_KEY=''
> $env:LAMBDA_EXECUTOR='docker'
> docker-compose -f docker-compose-localstack.yaml up
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
> aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket timeseries-ingest-lambda-artifacts
> aws --endpoint-url=http://localhost:4566 s3 cp C:\AlsoEnergy\timeseriesingest\GenericIngestAPILambdaFunctions\bin\Release\netcoreapp3.1\index.zip s3://timeseries-ingest-lambda-artifacts/GenericIngestAPILambdaFunctions/index.zip
> aws --endpoint-url=http://localhost:4566 cloudformation create-stack --stack-name test-kinesis-api --template-body file://C:\AlsoEnergy\timeseriesingest\cloudformation-templates\cloudformation-kinesis-api-resources.yaml --parameters ParameterKey=KinesisStreamName,ParameterValue=unified-ingest ParameterKey=Environment,ParameterValue=test
### Environment
```markdown
- OS: Windows
- LocalStack:
localstack_main | LocalStack build date: 2022-03-01
localstack_main | LocalStack build git hash: ff0ba560
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5674 | https://github.com/localstack/localstack/pull/5794 | 0f356a6024c4514d2f8f5942baf0a08098e18520 | 8a0cd56262790e5b91486361c018139dc0b8dc7b | 2022-03-14T19:54:23Z | python | 2022-04-01T20:06:12Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,671 | ["localstack/services/cloudformation/deployment_utils.py", "localstack/services/sqs/provider.py", "localstack/utils/cloudformation/template_deployer.py", "tests/integration/cloudformation/test_cloudformation_engine.py", "tests/integration/cloudformation/test_cloudformation_engine.snapshot.json"] | bug: Cannot create a target group using cloudformation | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When trying to create a stack with only a VPC and a TargetGroup, the deploy command fails with the following error:
`2022-03-14T14:28:13.883:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.ElasticLoadBalancingv2 object at 0x7f8f4f3fa6a0>> with params: {'Name': 'dfsd', 'Protocol': 'HTTP', 'Port': '3000', 'VpcId': 'vpc-0336b473', 'TargetType': 'ip'} for resource: {'Type': 'AWS::ElasticLoadBalancingV2::TargetGroup', 'LogicalResourceId': 'targetGroup1', 'Properties': {'Name': 'dfsd', 'Port': '3000', 'Protocol': 'HTTP', 'TargetType': 'ip', 'VpcId': 'vpc-0336b473'}, '_state_': {}}`
### Expected Behavior
A working cloudformation template should be created
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
TEST_AWS_ACCOUNT_ID="XXXX" LOCALSTACK_API_KEY=XXXX localstack start -d
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal cloudformation deploy --stack-name cfn-quickstart-stack --template-file "./cfn-quickstart-stack.yaml" # The quickstart s3 bucket from the sample
awslocal cloudformation deploy --stack-name my_stack --template-file deployment/environment/local-template.json --s3-bucket cfn-quickstart-bucket
#### The template used in the second command above:
```
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"myVPC" : {
"Type" : "AWS::EC2::VPC",
"Properties" : {
"CidrBlock" : "10.0.0.0/16",
"EnableDnsSupport" : "true",
"EnableDnsHostnames" : "true"
}
},
"targetGroup1": {
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
"Properties": {
"Name": "dfsd",
"Port": "3000",
"Protocol": "HTTP",
"TargetType": "ip",
"VpcId": { "Ref" : "myVPC" }
}
}
},
"Description": "Room Service Stack"
}
```
### Environment
```markdown
- OS: MacOS Big Sur 11.6
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5671 | https://github.com/localstack/localstack/pull/6662 | 7e3045dcdca255e01c0fbd5dbf0228e500e8f42e | 9613a8373a2bd2f394d1565b5fe57da1a283cac1 | 2022-03-14T14:29:17Z | python | 2022-08-16T18:17:18Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,604 | ["localstack/services/sns/provider.py", "localstack/testing/pytest/fixtures.py", "localstack/utils/aws/dead_letter_queue.py", "tests/integration/test_sns.py", "tests/integration/test_sns.snapshot.json", "tests/integration/test_sqs.py"] | question: Is there any reason behind SNS DLQ message have different format than original AWS? | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
I'm trying to implement locally DLQ for SNS with SQS, the problem is, on localstack SQS DLQ message coming from SNS have different format than what you would expect in AWS
When I tested locally I received the message in the following format:
`"{\"Action\": [\"Publish\"], \"Message\": [\"(The original SNS message body here)\"], \"TopicArn\": [\"the topic arn in localstack\"], \"Version\": [\"2010-03-31\"]}"`
I'm using local stack 0.14.0 with docker-compose
my docker-compose file looks like this:
```
aws:
image: localstack/localstack:0.14.0
restart: always
volumes:
- ./docker-mounts/localstack:/docker-entrypoint-initaws.d
environment:
- SERVICES=sqs,s3,ses,sns
- DEFAULT_REGION=eu-west-1
- HOSTNAME_EXTERNAL=aws.localtest.local
- AWS_ACCESS_KEY_ID=foo
- AWS_SECRET_ACCESS_KEY=bar
- AWS_DEFAULT_REGION=eu-west-1
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5604 | https://github.com/localstack/localstack/pull/6168 | 35bed8d751e17dd4e6ff0cb919efe4df888798e6 | 826eaf4e189ce7a9e246c0755dcf7404531fbb49 | 2022-03-04T09:20:12Z | python | 2022-05-31T15:03:07Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,598 | ["localstack/services/generic_proxy.py", "localstack/utils/server/http2_server.py", "tests/unit/utils/test_http2_server.py"] | bug: pushing an image up to localstack `ecr`; `awslocal ecr batch-get-images` says ImageNotFound? | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When trying to push an container image up to `localstack` via docker, and based on the advertised localstack.cloud documentation, I am then faced with multiple clues telling me that the image has in fact not been pushed to `localstack`.
### Expected Behavior
Localstack takes my container image, and I can use it to invoke a lambda function.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
file: `docker-compose.yml`
```yml
version: "3.8"
services:
localstack:
image: localstack/localstack:latest
environment:
- LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY-}
- EDGE_PORT=4566
- LAMBDA_EXECUTOR=docker
- LAMBDA_REMOTE_DOCKER=0
- SERVICES=rds,vpc,lambda,dynamodb,cloudformation,s3,sts,iam,apigateway,ecr,ec2
- HOST_TMP_FOLDER="${TMPDIR:-/tmp}/localstack"
- DEFAULT_REGION=us-west-1
- PORT_WEB_UI=8080
ports:
- '4510-4599:4510-4599'
- '8080:8080'
volumes:
# - '${TMPDIR:-/tmp/localstack}:/tmp/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'
privileged: true
```
cloudformation file: `template.yml`:
```yml
AWSTemplateFormatVersion: 2010-09-09
Resources:
DocSvcCreateDoc:
Type: AWS::Lambda::Function
Properties:
Code:
ImageUri: localhost:4510/createdoc
```
Steps:
1. `docker-compose up`
2. In a separate terminal, once the localstack application is stood up:
```bash
$ awslocal ecr create-repository --repository-name createdoc;
$ docker build -t localhost:4510/createdoc .;
$ docker push localhost:4510/createdoc;
$ awslocal cloudformation create-stack --stack-name test --template-body file://./template.yml;
```
None of the above commands fail. (1) The repository claims to be created, (2) I can turn around and inspect that it's been created, (3) `docker push localhost:4510/createdoc` has the tell-tale racing arrows of a regular docker push, (4) `create-stack` returns figures about a stack thats been created and the `localstack` log process shows activity like somethings being done after that command.
However:
1. As I am "uploading" my docker image to localstack, the **localstack** process (not to be confused with the process running docker push) shows no indication is log output that it is even frankly receiving anything.
2. When I try to `awslocal lambda invoke` my "created" function, I am met with an error in both terminals:
```log
localstack_1 | container_id = DOCKER_CLIENT.create_container(
localstack_1 | File "/opt/code/localstack/localstack/utils/container_utils/docker_sdk_client.py", line 535, in create_container
localstack_1 | raise ContainerException()
localstack_1 | localstack.utils.container_utils.container_client.ContainerException
localstack_1 | 2022-03-03T08:36:08.009:INFO:localstack_ext.services.awslambda.lambda_extended: Lambda container output: None
localstack_1 | None
```
3. When I:
```bash
$ awslocal ecr batch-get-images \
--repository-name createdoc \
--image-id \
imageDigest=<image-digest-for-localhost:4510/createdoc>,\
imageTag=latest`:
```
I am met with:
```JSON
{
"images": [],
"failures": [
{
"imageId": {
"imageDigest": "<image-digest-for-localhost:4510/createdoc>",
"imageTag": "latest"
},
"failureCode": "ImageNotFound",
"failureReason": "Requested image not found"
}
]
}
```
Which is disheartening. Although, I get conflicting results from `list-images`:
```bash
$ awslocal ecr list-images --repository-name createdoc
```
yields
```JSON
{
"imageIds": [
{
"imageDigest": "sha256:<image-digest-for-localhost:4510/createdoc>",
"imageTag": "latest"
}
]
}
```
So I'm not sure. It could be operator error. Let me know what you guys think.
### Environment
```markdown
- OS: Ubuntu 20.04 + [email protected] (Windows 10)
- LocalStack: latest
```
### Anything else?
You guys are awesome. | https://github.com/localstack/localstack/issues/5598 | https://github.com/localstack/localstack/pull/5617 | 353394df90106ceeac94409194bdbb50a567dfef | cc8f67b0cf86605a194e2bbb356281ceace13cda | 2022-03-03T09:04:30Z | python | 2022-03-05T23:13:39Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,587 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/services/apigateway/context.py", "localstack/services/apigateway/helpers.py", "localstack/services/apigateway/integration.py", "localstack/utils/aws/aws_stack.py", "localstack/utils/aws/templating.py", "localstack/utils/objects.py", "tests/unit/test_apigateway.py", "tests/unit/test_templating.py", "tests/unit/utils/test_common.py"] | bug: VTL request templates not handled properly | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Currently the VTL template for `request_templates` is not processed properly:
```
#set( $body = $input.json("$") )
#macro( loop $map )
{
#foreach($key in $map.keySet())
#set( $k = $util.escapeJavaScript($key) )
#set( $v = $util.escapeJavaScript($map.get($key)).replaceAll("\\'", "'") )
"$k": "$v"
#if( $foreach.hasNext ) , #end
#end
}
#end
{
"enhancedAuthContext": #loop($context.authorizer),
"headers": #loop($input.params().header),
"query": #loop($input.params().querystring),
"path": #loop($input.params().path),
"identity": #loop($context.identity),
"stageVariables": #loop($stageVariables),
}
EOF
}
```
results in,
```
'
{
"enhancedAuthContext": {
}
,
"headers": {
}
,
"query": {
}
,
"path": {
}
,
"identity": {
}
,
"stageVariables": {
}
,
}
'
```
### Expected Behavior
The template should be rendered and have the JSON properties.
### How are you starting LocalStack?
Custom (please describe below)
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run localstack/localstack
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal s3 mb s3://mybucket
### Environment
```markdown
- OS: MacOS
- LocalStack: 0.14
```
### Anything else?
This example can be used to validate.
https://github.com/localstack/localstack-terraform-samples/tree/master/apigateway-lambda-velocity | https://github.com/localstack/localstack/issues/5587 | https://github.com/localstack/localstack/pull/5618 | e91d3f7a1e07341de9a68ecb0d23a4b74397be6d | 29f5bfaf74eb56a3227582d1b565b4ce7ba7ea2e | 2022-02-28T17:54:14Z | python | 2022-03-10T10:35:33Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,562 | ["localstack/services/cloudwatch/alarm_scheduler.py", "localstack/services/cloudwatch/provider.py", "localstack/testing/snapshots/transformer_utility.py", "tests/integration/test_cloudwatch.py", "tests/integration/test_cloudwatch.snapshot.json", "tests/unit/test_cloudwatch.py"] | bug: SerializationError when calling cloudwatch "EnableAlarmActions" | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When calling
`cloudWatchClient.EnableAlarmActions(&cloudwatch.EnableAlarmActionsInput{AlarmNames: alarmNames})`
with golang I receive a SerializationError with bytes in the error message saying:
`<!DOCTYPE HTM |UBLIC "-//W3C//DTD HTML 3.2 Final//EN">.<title>500 Internal Server Error</title>.<h1>Internal Server Error</h1>.<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.`
I believe this is a bug, since other cloudwatch operations like "DescribeAlarms" work flawlessly with the same client.
### Expected Behavior
I expected the call to go through without any errors
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
Start localstack, create alarms and call cloudwatch "EnableAlarmActions"
### Environment
_No response_
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5562 | https://github.com/localstack/localstack/pull/6491 | b68805b7fa8cd99af0eb663a551908f0996a8a6b | f0ff5f861b4bb6db683189155a047f25cdbe3812 | 2022-02-23T16:30:44Z | python | 2022-07-28T10:24:39Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,546 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/services/apigateway/helpers.py"] | Mock integrations in API Gateway not working | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Beacuse we use localstack for alot of integration tests and we often need to mock some rest api I wanted to use the mock function of api gateway to make a simple rest api mock, but I cant get it to work properly.
When calling my api i get a empty dictionary response:
```
curl http://localhost:4566/restapis/kiyhgeyswi/test/_user_request_/123-v
* Uses proxy env variable no_proxy == 'localhost'
* Trying 127.0.0.1:4566...
* Connected to localhost (127.0.0.1) port 4566 (#0)
> GET /restapis/kiyhgeyswi/test/_user_request_/test HTTP/1.1
> Host: localhost:4566
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200
< Content-Type: application/json
< Content-Length: 2
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: HEAD,GET,PUT,POST,DELETE,OPTIONS,PATCH
< Access-Control-Allow-Headers: authorization,cache-control,content-length,content-md5,content-type,etag,location,x-amz-acl,x-amz-content-sha256,x-amz-date,x-amz-request-id,x-amz-security-token,x-amz-tagging,x-amz-target,x-amz-user-agent,x-amz-version-id,x-amzn-requestid,x-localstack-target,amz-sdk-invocation-id,amz-sdk-request
< Access-Control-Expose-Headers: etag,x-amz-version-id
< Connection: close
< date: Tue, 22 Feb 2022 08:29:28 GMT
< server: hypercorn-h11
<
{}
```
### Expected Behavior
It should respond with the mock response. When deploying the exact same api in aws a get this response:
```
curl https://$API_ID.execute-api.$REGION.amazonaws.com/dev/123
{
"statusCode": 200,
"id2": 123
}
```
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose up
```
version: '3.3'
services:
localstack:
image: localstack/localstack:latest
container_name: localstack_tests5
ports:
- '4566:4566'
- '4571:4571'
- '8080:8080'
environment:
- DOCKER_HOST=unix:///var/run/docker.sock
- SERVICES=kms,dynamodb,apigateway
- DEBUG=1
- DEFAULT_REGION=eu-west-1
- DATA_DIR=/tmp/localstack/data
- LAMBDA_EXECUTOR=local
- KINESIS_PROVIDER=kinesalite
- KMS_PROVIDER=local-kms
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
```
./create_mock_api.sh
```
#!/bin/bash
NAME=main
FILE=main.zip
HANDLER=main
REGION=us-east-1
#Create rest api
aws apigateway create-rest-api --region $REGION --name 'mockapi' --endpoint-url=http://localhost:4566
API_ID=$(aws apigateway get-rest-apis --query "items[?name==\`mockapi\`].id" --output text --region $REGION --endpoint-url=http://localhost:4566)
PARENT_RESOURCE_ID=$(aws apigateway get-resources --rest-api-id ${API_ID} --query 'items[0].id' --output text --region $REGION --endpoint-url=http://localhost:4566)
#Create resource associated with path
aws apigateway create-resource \
--region $REGION \
--rest-api-id $API_ID \
--parent-id $PARENT_RESOURCE_ID \
--path-part "{id}" \
--endpoint-url=http://localhost:4566
RESOURCEID=$(aws apigateway get-resources --rest-api-id $API_ID --region $REGION --endpoint-url=http://localhost:4566 --query 'items[?path==`/{id}`].id' --output text)
aws apigateway create-model \
--region $REGION \
--rest-api-id $API_ID \
--name Empty2 \
--content-type application/json \
--schema "{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\": \"Empty Schema2\", \"type\": \"object\" }" \
--endpoint-url=http://localhost:4566
#Create get method and method response
aws apigateway put-method \
--region $REGION \
--rest-api-id $API_ID \
--resource-id $RESOURCEID \
--http-method GET \
--authorization-type "NONE" \
--request-parameters "method.request.path.id=true" \
--endpoint-url=http://localhost:4566
aws apigateway put-method-response \
--region $REGION \
--rest-api-id $API_ID \
--resource-id $RESOURCEID \
--http-method GET \
--status-code 200 \
--response-models "application/json=Empty2" \
--endpoint-url=http://localhost:4566
#Integrate api
aws apigateway put-integration \
--region $REGION \
--rest-api-id $API_ID \
--resource-id $RESOURCEID \
--http-method GET \
--type MOCK \
--passthrough-behavior WHEN_NO_MATCH \
--request-templates '{ "application/json": "{\"statusCode\": 200}" }' \
--endpoint-url=http://localhost:4566
aws apigateway put-integration-response \
--region $REGION \
--rest-api-id $API_ID \
--resource-id $RESOURCEID \
--http-method GET \
--status-code 200 \
--response-templates '{"application/json": "{\"statusCode\": 200,\"id2\": $input.params().path.id}"}' \
--endpoint-url=http://localhost:4566
#deploy
aws apigateway create-deployment \
--region $REGION \
--rest-api-id $API_ID \
--stage-name test \
--endpoint-url=http://localhost:4566
curl http://localhost:4566/restapis/${API_ID}/test/_user_request_/test -v
```
### Environment
```markdown
- OS: Windows 10
- LocalStack: 0.14.0 (latest/9cfaf4f1c73a)
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5546 | https://github.com/localstack/localstack/pull/5568 | 0221d2908307c2b00e91336aa07e608669341788 | baee5eff3fb34ddc96fa55348820979d17cd1dce | 2022-02-22T08:44:43Z | python | 2022-02-28T11:49:48Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,520 | ["setup.cfg"] | bug: Poetry install localstack['runtime'] fails | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Poetry runs dependency resolver forever when I run `poetry add localstack['runtime']`
### Expected Behavior
Install should succeed
### How are you starting LocalStack?
Custom (please describe below)
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
Can't start it because it failed to install
### Environment
```markdown
- OS: Mac 10.15.6
- LocalStack: 0.14.0
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5520 | https://github.com/localstack/localstack/pull/5912 | ebd990b23cecc8958e0702143547fc78f0baa578 | 82bf31883d74b55783eaf16f639a92e72cab36d6 | 2022-02-18T22:39:30Z | python | 2022-04-22T08:59:16Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,508 | ["localstack/services/apigateway/apigateway_listener.py", "tests/integration/test_api_gateway.py"] | bug: API Gateway to S3, GET not yet implemented | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When creating an API Gateway with an integration of type AWS to S3, the uri to get objects from an S3 bucket is not working, returning:
`{
"status": 400,
"body": "{\"Type\": \"User\", \"message\": \"Error invoking integration for API Gateway ID '3en931aay2': API Gateway AWS integration action URI \\\"arn:aws:apigateway:us-east-1:s3:action/GetObject&Bucket=saxpress-drawio=Key={item}\\\", method \\\"GET\\\" not yet implemented\", \"__type\": \"InvalidRequest\"}",
"headers": {
"x-amzn-errortype": "InvalidRequest",
"Content-Type": "text/html; charset=utf-8",
"Content-Length": "280"
}
}`
### Expected Behavior
Retrieve S3 object.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```
localstack:
image: localstack/localstack:latest
hostname: localstack
environment:
- AWS_DEFAULT_REGION=us-east-1
- EDGE_PORT=4566
- HOSTNAME_EXTERNAL=localstack
- SERICES=s3,lambda,apigateway,apigatewayv2
- DEBUG=1
ports:
- '4566-4583:4566-4583'
- '8055:8080'
volumes:
- 'saxpress-localstack-data:/tmp/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'
- './.localstack:/docker-entrypoint-initaws.d'
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```
awslocal apigateway create-rest-api --region us-east-1 --name ${API_NAME} --endpoint-url=http://localhost:4566
awslocal apigateway create-resource \
--region ${REGION} \
--rest-api-id ${API_ID} \
--parent-id ${PARENT_RESOURCE_ID} \
--path-part "{proxy+}"
awslocal apigateway put-method \
--region ${REGION} \
--resource-id ${RESOURCE_ID} \
--rest-api-id ${API_ID} \
--http-method "GET" \
--authorization-type "NONE" \
--request-parameters "method.request.path.proxy=true"
awslocal apigateway put-integration \
--region ${REGION} \
--resource-id ${RESOURCE_ID} \
--rest-api-id ${API_ID} \
--type "AWS" \
--http-method "GET" \
--uri "arn:aws:apigateway:${REGION}:s3:action/GetObject&Bucket=${BUCKET_NAME}=Key={item}" \
--credentials "${ROLE_ARN}" \
--integration-http-method "GET" \
--request-parameters "integration.request.path.item=method.request.queryString.proxy,integration.request.path.object=context.requestId"
awslocal apigateway put-method-response \
--region ${REGION} \
--resource-id ${RESOURCE_ID} \
--rest-api-id ${API_ID} \
--status-code "200" \
--http-method "GET" \
--response-parameters "method.response.header.Content-Type=true" \
--response-models "application/json=Empty"
awslocal apigateway put-integration-response \
--region ${REGION} \
--resource-id ${RESOURCE_ID} \
--rest-api-id ${API_ID} \
--status-code "200" \
--http-method "GET" \
--response-parameters "method.response.header.Content-Type=integration.response.header.Content-Type"
```
Testing the method:
```
root@localstack:/opt/code/localstack# awslocal apigateway test-invoke-method --rest-api-id ${API_ID} --resource-id ${RESOURCE_ID} --http-method GET --path-with-query-string index.html
{
"status": 400,
"body": "{\"Type\": \"User\", \"message\": \"Error invoking integration for API Gateway ID '3en931aay2': API Gateway AWS integration action URI \\\"arn:aws:apigateway:us-east-1:s3:action/GetObject&Bucket=saxpress-drawio=Key={item}\\\", method \\\"GET\\\" not yet implemented\", \"__type\": \"InvalidRequest\"}",
"headers": {
"x-amzn-errortype": "InvalidRequest",
"Content-Type": "text/html; charset=utf-8",
"Content-Length": "280"
}
}
```
### Environment
```markdown
- OS: macOS Big Sur
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5508 | https://github.com/localstack/localstack/pull/5517 | 70018da7159ef4509ea4cd86bbd89323981d741d | d7cf22e2313718391f23f40bad355a407d5cdf25 | 2022-02-17T21:23:54Z | python | 2022-02-19T22:06:31Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,499 | ["localstack/services/generic_proxy.py"] | bug: Opening TCP connections to localstack slows down concurrent requests | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
It seems like whenever I open a connection to `localhost:4566` (4566 being exposed from the localstack container), for the next ~1 second any HTTP calls will have delayed responses. If I open 10 connections, the delay will be 10 seconds.
### Expected Behavior
Multiple connections can be opened and don't impact other requests until a certain connection limit.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
1. run localstack: `docker run --rm -it -p 4566:4566 --name ls localstack/localstack:0.14.0` - I managed to reproduce it with versions as old as 0.12.0
2. run something like this to see how long curls take inside the container:
```bash
docker exec -it ls /bin/bash
# inside the container:
while true; do time curl localhost:4566; sleep 0.1; done
```
3. open connections with telnet:
```
telnet localhost 4566
```
4. observe extended response times in the curl loop. For me it's ~1s extra per open connection (I'm simulating opening more connections with a JVM application opening sockets as I request).
### Environment
```markdown
- OS: macOS / ubuntu, tried both x86 and arm64 macs, and an arm64 linux
- LocalStack: 0.12.0, 0.13.1, 0.14.0
```
### Anything else?
This surfaces itself as extremely slow responses whenever you have e.g. a JVM application that keeps a cached connection pool. Even 10 connections in a pool are enough to cause consistent delays every couple seconds (which I think is after the connections are closed due to the defaults on my client), under no additional traffic targeting localstack. | https://github.com/localstack/localstack/issues/5499 | https://github.com/localstack/localstack/pull/6123 | c74e527d9f822dc8464390e96645ff8bdcb08668 | 8015c4455579e673b18ed74bd2d4ef763b43b67b | 2022-02-16T19:44:03Z | python | 2022-05-23T18:30:04Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,498 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/services/apigateway/context.py", "localstack/services/apigateway/helpers.py", "localstack/services/apigateway/integration.py"] | bug: API Gateway endpoint with SNS AWS integration - method "POST" not yet implemented | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I have a CDK deployment that creates API Gateway with a single POST endpoint, configured to proxy to SNS using AWS integration.
When I deploy with "cdk deploy" to AWS and then use curl/Postman to POST - everything works as expected.
When I deploy to localhost using "cdklocal deploy", the deployment works just fine, but POSTing to the endpoint returns the following error:
```
Exception: API Gateway AWS integration action URI "arn:aws:apigateway:us-east-1:sns:path/000000000000/cdk--dev--event-topic", method "POST" not yet implemented
```
HTTP status code returned is 400 Bad Request
### Expected Behavior
I expected for the solution to work just like it does in AWS, forwarding API Gateway POST to SNS and returning 200.
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
export LOCALSTACK_API_KEY=<my-api-key>
localstack start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```typescript
import {Stack, StackProps, aws_apigateway as apigateway, aws_sns as sns, aws_iam as iam, Aws} from 'aws-cdk-lib';
import {Construct} from 'constructs';
import {Stage} from "./config";
interface Props extends StackProps {
stage: Stage;
}
export class SourceGatewayStack extends Stack {
constructor(scope: Construct, id: string, props: Props) {
super(scope, id, props);
const api = new apigateway.RestApi(this, `cdk--${props.stage}--source-api`, {
deploy: true,
deployOptions: {
stageName: props.stage,
loggingLevel: apigateway.MethodLoggingLevel.INFO,
tracingEnabled: true
}
});
const topic = new sns.Topic(this, `cdk--${props.stage}--event-topic`, {
displayName: `Event Topic (${props.stage})`,
topicName: `cdk--${props.stage}--event-topic`
});
const eventResource = api.root.addResource('event');
const snsTopicIntegration = this.buildSnsTopicIntegration(topic);
eventResource.addMethod('POST', snsTopicIntegration, {
methodResponses: [{statusCode: "200"}, {statusCode: "400"}]
});
}
private buildSnsTopicIntegration(topic: sns.Topic) {
const gatewayExecutionRole = new iam.Role(this, "GatewayExecutionRole", {
assumedBy: new iam.ServicePrincipal("apigateway.amazonaws.com"),
inlinePolicies: {
"PublishMessagePolicy": new iam.PolicyDocument({
statements: [new iam.PolicyStatement({
actions: ["sns:Publish"],
resources: [topic.topicArn]
})]
})
}
});
return new apigateway.AwsIntegration({
service: 'sns',
integrationHttpMethod: 'POST',
path: `${Aws.ACCOUNT_ID}/${topic.topicName}`,
options: {
credentialsRole: gatewayExecutionRole,
passthroughBehavior: apigateway.PassthroughBehavior.NEVER,
requestParameters: {
"integration.request.header.Content-Type": `'application/x-www-form-urlencoded'`,
},
requestTemplates: {
"application/json": `Action=Publish&TopicArn=$util.urlEncode('${topic.topicArn}')&Message=$util.urlEncode($input.body)`,
},
integrationResponses: [
{
statusCode: "200",
responseTemplates: {
"application/json": `{"status": "message published"}`,
},
},
{
statusCode: "400",
selectionPattern: "^\[Error\].*",
responseTemplates: {
"application/json": `{\"state\":\"error\",\"message\":\"$util.escapeJavaScript($input.path('$.errorMessage'))\"}`,
},
}
],
}
});
}
}
```
This is the POST request to localstack:
```
curl --location --request POST 'http://localhost:4566/restapis/67o2r1jppd/dev/_user_request_/event' \
--header 'Content-Type: application/json' \
--data-raw '{
"test": "data"
}
'
```
Response is:
```
{"Type": "User", "message": "Error invoking integration for API Gateway ID '67o2r1jppd': API Gateway AWS integration action URI \"arn:aws:apigateway:us-east-1:sns:path/000000000000/cdk--dev--event-topic\", method \"POST\" not yet implemented", "__type": "InvalidRequest"}
```
### Environment
```markdown
- OS: MacOS Monterey 12.1
- LocalStack: 0.14.0
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5498 | https://github.com/localstack/localstack/pull/5505 | d7cf22e2313718391f23f40bad355a407d5cdf25 | a6eb1febd2a7938b44a70e584ac6c73e84bb278e | 2022-02-16T16:51:30Z | python | 2022-02-19T22:08:24Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,497 | ["localstack/services/es/provider.py", "localstack/services/opensearch/provider.py", "tests/integration/test_es.py", "tests/integration/test_opensearch.py"] | feature request: implement es update-elasticsearch-domain-config | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
Hello team. Please, kindly work on this feature for awslocal CLI:
awslocal es update-elasticsearch-domain-config --domain-name my-domain --region us-east-1 \
--advanced-security-options '{ "Enabled": true, "InternalUserDatabaseEnabled":true, "MasterUserOptions": {"MasterUserName":"master-username","MasterUserPassword":"master-password"},"AnonymousAuthEnabled": true}'
Right now it returns the following response:
An error occurred (InternalFailure) when calling the UpdateElasticsearchDomainConfig operation: API action 'UpdateElasticsearchDomainConfig' for service 'es' not yet implemented
Thank you,
Victor
### 🧑💻 Implementation
_No response_
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5497 | https://github.com/localstack/localstack/pull/5552 | 1dcdd37d8bbbe00ca849b609df4f2b0c06a9d306 | 168bac4be8c86d3884ece683e73cce5f3d02070e | 2022-02-16T15:52:34Z | python | 2022-04-01T07:50:12Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,468 | ["localstack/utils/container_utils/container_client.py", "localstack/utils/container_utils/docker_cmd_client.py", "localstack/utils/container_utils/docker_sdk_client.py", "tests/integration/docker_utils/test_docker.py"] | feature request: Support running a debugger in ECS containers | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
To enable running a debugger (e.g. [delve](https://github.com/go-delve/delve)) in a container running in ECS in Localstack the container needs certain security related options. This includes adding the `SYS_PTRACE` permission, and on Linux, running with an apparmor profile that allows the container to run tracing.
Task definitions in AWS supports setting these options through the `dockerSecurityOptions` and `linuxParameters`.
These fields are currently not propagated to a container started in Localstack, which prevents doing remote debugging of containers in Localstack ECS.
Here is a task definition containing setting for added permissions, and specifying an apparmor profile.
```json
{
"taskDefinition": {
"taskDefinitionArn": "arn:aws:ecs:us-east-1:000000000000:task-definition/rest-api-8aa8c290507be0b4:1",
"containerDefinitions": [
{
"name": "app",
"image": "localhost:4510/rest-api-registry-232449743180e1e4:b2e51cf4c154aa1b6efeb744a47fd7d6",
"cpu": 256,
"memoryReservation": 512,
"portMappings": [
{
"containerPort": 8080
},
{
"containerPort": 2345
}
],
"essential": true,
"mountPoints": [],
"volumesFrom": [],
"linuxParameters": {
"capabilities": {
"add": [
"SYS_PTRACE"
]
},
"initProcessEnabled": true
},
"disableNetworking": false,
"privileged": false,
"readonlyRootFilesystem": false,
"dockerSecurityOptions": [
"apparmor:unconfined"
],
"interactive": false,
"pseudoTerminal": false,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/aws/ecs/app/20220203134424131100000003",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "app"
}
}
}
],
"family": "rest-api-8aa8c290507be0b4",
"taskRoleArn": "arn:aws:iam::000000000000:role/rest-api-role-20220203134423848400000002",
"executionRoleArn": "arn:aws:iam::000000000000:role/rest-api-8aa8c290507be0b4",
"networkMode": "awsvpc",
"revision": 1,
"volumes": [],
"status": "ACTIVE",
"placementConstraints": [],
"compatibilities": [
"EC2",
"FARGATE"
],
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "1024",
"memory": "2048"
}
}
```
A container started with these settings should contain the following output when inspecting.
```json
[
{
...
"HostConfig": {
"CapAdd": [
"SYS_PTRACE"
],
"SecurityOpt": [
"apparmor:unconfined"
],
}
...
}
]
```
### 🧑💻 Implementation
The relevant settings can be set with the Docker CLI using `--security-opt="apparmor=unconfined"` and `--cap-add=SYS_PTRACE`.
For the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate), `dockerSecurityOptions` maps to `SecurityOpt` while `linuxParameters` would go under `CapAdd` or `CapDrop`, both under `HostConfig`.
### Anything else?
A guide to running the Delve debugger in a container: https://blog.jetbrains.com/go/2020/05/06/debugging-a-go-application-inside-a-docker-container/#changing-the-run-configuration
Task definition security parameters: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_security
Task definition linux parameters: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#other_container_definition_params | https://github.com/localstack/localstack/issues/5468 | https://github.com/localstack/localstack/pull/6001 | 38b35e76a6885b89569ddb270f7613233bc9bde8 | 87fd299ffc8a84a277827fd3f7ef702a94322fea | 2022-02-10T14:05:09Z | python | 2022-05-03T19:06:22Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,456 | ["localstack/services/awslambda/lambda_executors.py"] | bug: LocalStack doesn't apply the response data from custom resource provider | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
The issue is following by:
I created dynamodb table as a custom resource and provider is lambda function, which is sending response data to CF
The table has been created successfully and another resource is trying to get attribute from this table resource (StreamArn attribute which has been returned from lambda provider function as a response to CF's create event)
But CF can't extract this attribute..
I guess CF doesn't set returned response data and physical id correctly from the response..
### Expected Behavior
It should apply response data and `physical resource id` to the created resource
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose up
### Environment
```markdown
- OS: macOS Catalina
- LocalStack: latest
```
### Anything else?
here is the localstack log I am seeing:
```
from resource: {'result': {'Status': 'SUCCESS', 'Reason': 'See the details in CloudWatch Log Stream: 2022/02/08/[$LATEST]a3d474e5b93486e21e3891f665c40839', 'PhysicalResourceId': 'Master-local', 'StackId': 'arn:aws:cloudformation:us-west-2:000000000000:stack/db-local/id-123', 'RequestId': 'af1b8bb6', 'LogicalResourceId': 'MasterTable', 'NoEcho': False, 'Data': {'StreamArn': 'arn:aws:dynamodb:us-west-2:000000000000:table/Master-local/stream/2022-02-08T19:02:13.455'}}} {'Type': 'Custom::DynamoDB', 'LogicalResourceId': 'MasterTable', 'Properties': {'ServiceToken': 'arn:aws:lambda:us-west-2:000000000000:function:db-local-dynamodb', 'TableName': 'Master-local', 'BackupArn': 'null'}, '_state_': {'result': {'Status': 'SUCCESS', 'Reason': 'See the details in CloudWatch Log Stream: 2022/02/08/[$LATEST]a3d474e5b93486e21e3891f665c40839', 'PhysicalResourceId': 'Master-local', 'StackId': 'arn:aws:cloudformation:us-west-2:000000000000:stack/db-local/id-123', 'RequestId': 'af1b8bb6', 'LogicalResourceId': 'MasterTable', 'NoEcho': False, 'Data': {'StreamArn': 'arn:aws:dynamodb:us-west-2:000000000000:table/Master-local/stream/2022-02-08T19:02:13.455'}}}, 'PhysicalResourceId': 'MasterTable'}
localstack | 2022-02-08T19:02:15.360:ERROR:lambda_api: Exception on /2015-03-31/event-source-mappings/ [POST]
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
localstack | response = self.full_dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
localstack | rv = self.handle_user_exception(e)
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack | return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
localstack | rv = self.dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
localstack | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1880, in create_event_source_mapping
localstack | mapping = add_event_source(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 457, in add_event_source
localstack | mapping = build_mapping_obj(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 437, in build_mapping_obj
localstack | source_arn = data["EventSourceArn"]
localstack | KeyError: 'EventSourceArn'
localstack | 2022-02-08T19:02:15.958:ERROR:lambda_api: Exception on /2015-03-31/event-source-mappings/ [POST]
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
localstack | response = self.full_dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
localstack | rv = self.handle_user_exception(e)
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack | return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
localstack | rv = self.dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
localstack | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1880, in create_event_source_mapping
localstack | mapping = add_event_source(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 457, in add_event_source
localstack | mapping = build_mapping_obj(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 437, in build_mapping_obj
localstack | source_arn = data["EventSourceArn"]
localstack | KeyError: 'EventSourceArn'
localstack | 2022-02-08T19:02:17.681:ERROR:lambda_api: Exception on /2015-03-31/event-source-mappings/ [POST]
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
localstack | response = self.full_dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
localstack | rv = self.handle_user_exception(e)
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack | return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
localstack | rv = self.dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
localstack | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1880, in create_event_source_mapping
localstack | mapping = add_event_source(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 457, in add_event_source
localstack | mapping = build_mapping_obj(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 437, in build_mapping_obj
localstack | source_arn = data["EventSourceArn"]
localstack | KeyError: 'EventSourceArn'
localstack | 2022-02-08T19:02:20.408:ERROR:lambda_api: Exception on /2015-03-31/event-source-mappings/ [POST]
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
localstack | response = self.full_dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
localstack | rv = self.handle_user_exception(e)
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack | return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
localstack | rv = self.dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
localstack | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1880, in create_event_source_mapping
localstack | mapping = add_event_source(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 457, in add_event_source
localstack | mapping = build_mapping_obj(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 437, in build_mapping_obj
localstack | source_arn = data["EventSourceArn"]
localstack | KeyError: 'EventSourceArn'
localstack | 2022-02-08T19:02:25.094:ERROR:lambda_api: Exception on /2015-03-31/event-source-mappings/ [POST]
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
localstack | response = self.full_dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
localstack | rv = self.handle_user_exception(e)
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack | return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
localstack | rv = self.dispatch_request()
localstack | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
localstack | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1880, in create_event_source_mapping
localstack | mapping = add_event_source(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 457, in add_event_source
localstack | mapping = build_mapping_obj(data)
localstack | File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 437, in build_mapping_obj
localstack | source_arn = data["EventSourceArn"]
localstack | KeyError: 'EventSourceArn'
localstack | 2022-02-08T19:02:25.098:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.Lambda object at 0x7f0f19aeefd0>> with params: {'BatchSize': 1, 'Enabled': True, 'FunctionName': 'arn:aws:lambda:us-west-2:000000000000:function:db-local-transaction', 'StartingPosition': 'LATEST'} for resource: {'Type': 'AWS::Lambda::EventSourceMapping', 'DependsOn': ['MasterTable'], 'LogicalResourceId': 'MasterTableStream', 'Properties': {'BatchSize': 1, 'Enabled': True, 'EventSourceArn': None, 'FunctionName': 'arn:aws:lambda:us-west-2:000000000000:function:db-local-transaction', 'StartingPosition': 'LATEST'}, '_state_': {}}
```
and I am using serverless framework to deploy the app.
```
resources: # CloudFormation template syntax
Resources:
MasterTable:
Type: Custom::DynamoDB
Properties:
ServiceToken:
Fn::GetAtt:
- DynamodbLambdaFunction
- Arn
TableName: ${ssm:/${self:custom.common.stage}/TABLE_NAME}
BackupArn: ${ssm:/${self:custom.common.stage}/BACKUP_ARN}
MasterTableStream:
Type: AWS::Lambda::EventSourceMapping
DependsOn: MasterTable
Properties:
# The maximum number of DB items to send to Lambda
BatchSize: 1 # It can be changed based on the need
Enabled: True
EventSourceArn:
Fn::GetAtt: [MasterTable, StreamArn]
FunctionName:
Fn::GetAtt: [TransactionLambdaFunction, Arn]
# Always start at the tail of the Stream
StartingPosition: LATEST
```
This is resources section of the service being deployed to localstack
As you can see, after the successful deployment of MasterTable, I am trying to deploy MasterTableStream by getting StreamArn of MasterTable, at this point I am getting this error.
The issue is that CF doesn't update the properties of MasterTable like physical id or StreamArn from the response got through custom resource provider function.
This is the response custom resource provider function is sending to CF back after creating table:
```
{
"Status": "SUCCESS",
"Reason": "See the details in CloudWatch Log Stream: 2022/02/08/[$LATEST]a3d474e5b93486e21e3891f665c40839",
"PhysicalResourceId": "Master-local",
"StackId": "arn:aws:cloudformation:us-west-2:000000000000:stack/db-local/id-123",
"RequestId": "af1b8bb6",
"LogicalResourceId": "MasterTable",
"NoEcho": false,
"Data": {
"StreamArn": "arn:aws:dynamodb:us-west-2:000000000000:table/Master-local/stream/2022-02-08T19:02:13.455"
}
}
```
Of course, everything is working on AWS successfully, just this part is not being worked with localstack.
I expect your quick investigation and help, Thanks
| https://github.com/localstack/localstack/issues/5456 | https://github.com/localstack/localstack/pull/5578 | 5379cbfd59ee57b713ffc6f6cbb6cb0ffef76069 | fe36c3c3d34091769795d57dc3413425f8311d13 | 2022-02-09T17:44:55Z | python | 2022-02-26T09:22:09Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,407 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/services/apigateway/helpers.py", "localstack/services/cloudformation/models/apigateway.py", "localstack/utils/aws/aws_stack.py", "localstack/utils/cloudformation/template_deployer.py", "tests/integration/templates/template35.yaml", "tests/integration/test_api_gateway.py", "tests/unit/test_apigateway.py"] | bug: API Gateway: request data mapping and request validation don't appear to be supported in pro | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I am creating an API Gateway with a Lambda Authorizer via a CloudFormation stack. The stack specifies a data mapping from the request body passed to the API to the request body expected by Kinesis (search `RequestTemplates` in the attached CloudFormation template). It also specifies a model and a validator which are used to validate the request body. Both of these aspects of the API work in AWS itself but appear to be ignored in LocalStack.
If I test with the same request body I passed to AWS, LocalStack throws an error indicating that the PutRecord call to Kinesis isn't providing a PartitionKey field. The data mapping should've taken care of it. If I then invoke the API in LocalStack with what *should* be sent to Kinesis, the invocation succeeds. This second invocation *should* violate the validation logic in the template, but doesn't.
### Expected Behavior
The data mapping should correctly map the passed-in request body to a request body which Kinesis can understand. In addition, the validator should reject requests that don't pass validation.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run --rm -it -p 4566:4566 -p 4571:4571 -e LOCALSTACK_API_KEY=$env:LOCALSTACK_API_KEY localstack/localstack
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```
# create s3 bucket and upload c# lambda authorizer zip to s3
aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket timeseries-ingest-lambda-artifacts
aws --endpoint-url=http://localhost:4566 s3 cp index.zip s3://timeseries-ingest-lambda-artifacts/KinesisAPILambdaAuthorizer/index.zip
# create stream
aws --endpoint-url=http://localhost:4566 kinesis create-stream --stream-name test-timeseries-ingest-stream --shard-count 1
# create stack
aws --endpoint-url=http://localhost:4566 cloudformation create-stack --stack-name test-kinesis-api --template-body file://cloudformation-kinesis-api-resources-PER-ENVIRONMENT.yaml --parameters ParameterKey=AppName,ParameterValue=timeseries-ingest ParameterKey=Environment,ParameterValue=test
```
This is the CloudFormation template: [cloudformation-kinesis-api-resources-PER-ENVIRONMENT.yaml.txt](https://github.com/localstack/localstack/files/7973188/cloudformation-kinesis-api-resources-PER-ENVIRONMENT.yaml.txt)
### Environment
```markdown
- OS: Ubuntu 20.04
- LocalStack: latest (as of 3 days ago)
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5407 | https://github.com/localstack/localstack/pull/5430 | 8484b1a8e8d13f4c482638ab905ca964d227b706 | e2d0407d7f74fb8b10c3e0347c56ea250a5f3b3c | 2022-01-31T18:37:09Z | python | 2022-02-08T14:33:37Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,387 | ["localstack/services/events/provider.py", "localstack/services/events/scheduler.py", "localstack/testing/aws/eventbus_utils.py", "tests/aws/services/events/conftest.py", "tests/aws/services/events/scheduled_rules/__init__.py", "tests/aws/services/events/scheduled_rules/test_events_scheduled_rules_logs.py", "tests/aws/services/events/scheduled_rules/test_events_scheduled_rules_logs.snapshot.json", "tests/aws/services/events/scheduled_rules/test_events_scheduled_rules_sqs.py", "tests/aws/services/events/scheduled_rules/test_events_scheduled_rules_sqs.snapshot.json", "tests/aws/services/events/test_events.py"] | bug: EventBridge Scheduled Rules generate an empty event | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When a scheduled rules runs, an empty event is generated and sent to targets.
### Expected Behavior
An event like this sample should be sent.
```json
{
"version": "0",
"id": "89d1a02d-5ec7-412e-82f5-13505f849b41",
"detail-type": "Scheduled Event",
"source": "aws.events",
"account": "123456789012",
"time": "2016-12-30T18:44:49Z",
"region": "us-east-1",
"resources": ["arn:aws:events:us-east-1:123456789012:rule/SampleRule"],
"detail": {}
}
```
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose up
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal events put-rule --name scheduled_rule --schedule-expression "rate(1 minutes)"
awslocal events put-targets --rule scheduled_rule --targets "Id"="1","Arn"="arn:aws:logs:us-east-1:000000000000:log-group:/aws/events/echo"
awslocal--endpoint-url=http://localhost:4566 logs tail "/aws/events/echo"
### Environment
```markdown
- OS: macOS Monterey
- LocalStack: 0.13.3
```
### Anything else?
I think [this](https://github.com/localstack/localstack/blob/1567f25a8f672f4dec23cb7cb1aadb5a744366f8/localstack/services/events/events_listener.py#L92) means an non-empty event is sent only when an input is `Constant (JSON text)`.

| https://github.com/localstack/localstack/issues/5387 | https://github.com/localstack/localstack/pull/9271 | 06606c844813afe4112405fcb3192d2f33a38a1f | d4f38c211d856ce987015b8d9197a008ceaae22b | 2022-01-28T16:18:33Z | python | 2023-10-10T11:41:35Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,357 | [".github/workflows/pro-integration.yml", "localstack/services/firehose/provider.py", "localstack/utils/aws/aws_stack.py", "requirements.txt", "tests/integration/conftest.py", "tests/integration/test_firehose.py"] | bug: `AmazonopensearchserviceDestinationConfiguration` is not supported for Firehose-Streams | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
As mentioned [here](https://github.com/localstack/localstack/issues/4834#issuecomment-1021009701) it seems like the `AmazonopensearchserviceDestinationConfiguration` was not added while implementing OpenSearch. I guess it just needs be added [here](https://github.com/localstack/localstack/blob/53b5c7788bf35b1882b6cb1949e17d27e198cf61/localstack/services/cloudformation/models/kinesisfirehose.py#L23-L27).
### Expected Behavior
I can (and should) use `AmazonopensearchserviceDestinationConfiguration` instead of `ElasticsearchDestinationConfiguration` (which I should only be able to use if I use ElasticSearch-Service).
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
Well, just use `AmazonopensearchserviceDestinationConfiguration` and your stream will never be able to deliver the records to your (external) Cluster. But it works with `ElasticsearchDestinationConfiguration`.
### Environment
```markdown
- OS: Windows mit WSL (Ubuntu 20.04)
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5357 | https://github.com/localstack/localstack/pull/5379 | 507c42709ce08911153840f8b2e43b74f52ee9a5 | e023c9bd4c6fdbf819e36653648e2e6246145c88 | 2022-01-25T13:10:50Z | python | 2022-02-04T15:59:24Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,337 | ["localstack/config.py", "localstack/services/sqs/provider.py", "tests/integration/test_sns.py", "tests/integration/test_sqs.py"] | bug: SNS to SQS subscription breaks on republished 0.13.3 version | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When a SNS to SQS subscription is used it will throw an exception in the latest version.
```
2022-01-24T05:57:14.420:INFO:localstack.services.sns.sns_listener: Unable to forward SNS message to SQS: Could not connect to the endpoint URL: "http://localhost:4567/" Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/httpsession.py", line 385, in send
urllib_response = conn.urlopen(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 525, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 92, in _send_request
rval = super(AWSConnection, self)._send_request(
File "/usr/local/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 120, in _send_output
self.send(msg)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 204, in send
return super(AWSConnection, self).send(str)
File "/usr/local/lib/python3.8/http/client.py", line 951, in send
self.connect()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPConnection object at 0x7f0254f56040>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/sns/sns_listener.py", line 522, in message_to_subscriber
sqs_client.send_message(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 391, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 705, in _make_api_call
http, parsed_response = self._make_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 725, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 104, in make_request
return self._send_request(request_dict, operation_model)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 138, in _send_request
while self._needs_retry(attempts, operation_model, request_dict,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 254, in _needs_retry
responses = self._event_emitter.emit(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 357, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 250, in __call__
should_retry = self._should_retry(attempt_number, response,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 316, in __call__
checker_response = checker(attempt_number, response,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 222, in __call__
return self._check_caught_exception(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 201, in _do_get_response
http_response = self._send(request)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 270, in _send
return self.http_session.send(request)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/httpsession.py", line 414, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://localhost:4567/"
2022-01-24T05:57:17.918:INFO:localstack.services.sns.sns_listener: Unable to forward SNS message to SQS: Could not connect to the endpoint URL: "http://localhost:4567/" Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/httpsession.py", line 385, in send
urllib_response = conn.urlopen(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 525, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 92, in _send_request
rval = super(AWSConnection, self)._send_request(
File "/usr/local/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 120, in _send_output
self.send(msg)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 204, in send
return super(AWSConnection, self).send(str)
File "/usr/local/lib/python3.8/http/client.py", line 951, in send
self.connect()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPConnection object at 0x7f0254583100>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/sns/sns_listener.py", line 522, in message_to_subscriber
sqs_client.send_message(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 391, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 705, in _make_api_call
http, parsed_response = self._make_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 725, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 104, in make_request
return self._send_request(request_dict, operation_model)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 138, in _send_request
while self._needs_retry(attempts, operation_model, request_dict,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 254, in _needs_retry
responses = self._event_emitter.emit(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 357, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 250, in __call__
should_retry = self._should_retry(attempt_number, response,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 316, in __call__
checker_response = checker(attempt_number, response,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 222, in __call__
return self._check_caught_exception(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 201, in _do_get_response
http_response = self._send(request)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 270, in _send
return self.http_session.send(request)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/httpsession.py", line 414, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://localhost:4567/"
2022-01-24T05:57:18.259:INFO:localstack.services.sns.sns_listener: Unable to forward SNS message to SQS: Could not connect to the endpoint URL: "http://localhost:4567/" Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/httpsession.py", line 385, in send
urllib_response = conn.urlopen(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 525, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 92, in _send_request
rval = super(AWSConnection, self)._send_request(
File "/usr/local/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 120, in _send_output
self.send(msg)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/awsrequest.py", line 204, in send
return super(AWSConnection, self).send(str)
File "/usr/local/lib/python3.8/http/client.py", line 951, in send
self.connect()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPConnection object at 0x7f025456dca0>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/sns/sns_listener.py", line 522, in message_to_subscriber
sqs_client.send_message(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 391, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 705, in _make_api_call
http, parsed_response = self._make_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 725, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 104, in make_request
return self._send_request(request_dict, operation_model)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 138, in _send_request
while self._needs_retry(attempts, operation_model, request_dict,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 254, in _needs_retry
responses = self._event_emitter.emit(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 357, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 250, in __call__
should_retry = self._should_retry(attempt_number, response,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 316, in __call__
checker_response = checker(attempt_number, response,
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 222, in __call__
return self._check_caught_exception(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 201, in _do_get_response
http_response = self._send(request)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/endpoint.py", line 270, in _send
return self.http_session.send(request)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/httpsession.py", line 414, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://localhost:4567/"
```
### Expected Behavior
SNS to SQS subscription should work as before version 0.13.3
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
docker-compose.yml:
```
version: '3.5'
services:
localstack:
image: localstack/localstack:0.13.3
ports:
- "4567:4566"
volumes:
- ./localstack/init-localstack.sh:/docker-entrypoint-initaws.d/init-localstack.sh
environment:
- DEFAULT_REGION=eu-central-1
- SERVICES=sns,sqs,dynamodb,s3
- SQS_PORT_EXTERNAL=4567
- START_WEB=0
```
init-localstack.sh:
```sh
awslocal sns create-topic --name test-output-topic
awslocal sqs create-queue --queue-name test-output-queue
awslocal sns subscribe \
--topic-arn arn:aws:sns:eu-central-1:000000000000:test-output-topic \
--protocol sqs \
--attributes RawMessageDelivery=true \
--notification-endpoint http://localhost:4567/000000000000/test-output-queue
```
send a message:
`docker compose exec localstack awslocal sns publish --topic-arn arn:aws:sns:eu-central-1:000000000000:test-output-topic --message test`
will return a MessageId but the docker compose log will show the above exception
### Environment
```markdown
- OS: Ubuntu 21.10
- LocalStack: 0.13.3
```
### Anything else?
Bug was likely introduced by 31199e5bd9d0b61dc14e2e8f256b409ecc5ccc20 | https://github.com/localstack/localstack/issues/5337 | https://github.com/localstack/localstack/pull/5388 | e9bfab3b3deb192a3f73359cd5ca0a6f15d96184 | 1ce07121755a5e08ef43f7928ae2194d077fef70 | 2022-01-24T06:25:14Z | python | 2022-01-28T22:17:36Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,322 | ["localstack/aws/api/sqs/__init__.py", "localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | feature request: Support for SSE in SQS | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
LocalStack should support Server-Side-Encryption for SQS if possible, or at least pretend it does so that scripts that assume this working against AWS don't break with LocalStack.
Currently terraform for example fails when trying to create an SQS queue with `sqs_managed_sse_enabled = true`
### 🧑💻 Implementation
It would probably be fine for now to at least simulate this in a basic `CRUD` way for at least the case when using AWS managed keys for the "encryption".
Example terraform:
```hcl
provider "aws" {
access_key = "test"
secret_key = "test"
region = "us-east-1"
s3_force_path_style = true
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
endpoints {
sqs = "http://localhost:4566"
iam = "http://localhost:4566"
}
}
resource "aws_sqs_queue" "sqs" {
name = "myq.fifo"
fifo_queue = true
content_based_deduplication = true
sqs_managed_sse_enabled = true
tags = {
service = "myq"
}
}
```
### Anything else?
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html | https://github.com/localstack/localstack/issues/5322 | https://github.com/localstack/localstack/pull/5366 | 80fd270211124390fa6f6b00e6c9b55fe4b682e5 | b53574d11359dcf05fe7f48c69e0b85fffe276e0 | 2022-01-21T07:04:40Z | python | 2022-01-28T01:12:42Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,301 | ["localstack/services/awslambda/event_source_listeners/sqs_event_source_listener.py", "localstack/services/awslambda/lambda_api.py", "tests/integration/awslambda/functions/lambda_sqs_batch_item_failure.py", "tests/integration/awslambda/test_lambda_sqs_integration.py", "tests/integration/awslambda/test_lambda_sqs_integration.snapshot.json"] | feature request: support for reporting partial batch failure for a SQS batch | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
AWS lambda has [support for reporting partial batch failure for a SQS batch](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting). We're currently using it for our lambda functions on our [serverless.yml](https://www.serverless.com/blog/improved-sqs-batch-error-handling-with-aws-lambda), and would like to test the configuration locally. It'd be great to have it supported on LocalStack.
### 🧑💻 Implementa
_No response_
### Anything else?

```
"FunctionResponseTypes": [
"ReportBatchItemFailures"
]
```
is missing from localstack's event source mapping despite setting it | https://github.com/localstack/localstack/issues/5301 | https://github.com/localstack/localstack/pull/6606 | 5f9e409146a708fb6023cde02362b25159c41d61 | 70268a7c985bc2f8bb9054b52f7c138305c2f900 | 2022-01-19T10:03:08Z | python | 2022-08-18T11:09:44Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,297 | ["localstack/aws/protocol/serializer.py", "tests/integration/test_sqs.py", "tests/unit/aws/protocol/test_serializer.py"] | bug: ASF does not encode XML message content correctly | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
when executing the commands from this issue
* #5293
specifically the last command:
aws --debug --endpoint-url="http://localhost:4566" sqs change-message-visibility --queue-url http://localhost:4566/000000000000/MyQueue --receipt-handle garbage --visibility-timeout 30
i get the following XML response:
```xml
<ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Code>ReceiptHandleIsInvalid</Code><Message>The input receipt handle "garbage" is not a valid receipt handle.</Message></Error><RequestId>RC7Q6J8V0LJ4EN2WQXGANXA2XWRL13D4GN6NVJF1V8UFBAVEO417</RequestId></ErrorResponse>
```
and the following headers:
```python
{
'Content-Type': 'text/plain; charset=utf-8',
'Content-Length': '309',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'HEAD,GET,PUT,POST,DELETE,OPTIONS,PATCH',
'Access-Control-Allow-Headers': 'authorization,cache-control,content-length,content-md5,content-type,etag,location,x-amz-acl,x-amz-content-sha256,x-amz-date,x-amz-request-id,x-amz-security-token,x-amz-tagging,x-amz-target,x-amz-user-agent,x-amz-version-id,x-amzn-requestid,x-localstack-target,amz-sdk-invocation-id,amz-sdk-request',
'Access-Control-Expose-Headers': 'etag,x-amz-version-id',
'Connection': 'close',
'date': 'Tue, 18 Jan 2022 23:17:17 GMT',
'server': 'hypercorn-h11',
}
```
this XML has three issues:
1. there's no `<?xml` start declaration
2. the message content is not HTML encoded (`"` should be `"`)
3. the content type is `text/plain`
### Expected Behavior
The XML returned by AWS looks as follows:
```xml
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>ReceiptHandleIsInvalid</Code><Message>The input receipt handle "garbage" is not a valid receipt handle.</Message><Detail/></Error><RequestId>bd34a56b-d17a-552a-b343-ff0b22169609</RequestId></ErrorResponse>
```
with the following response headers:
```python
{
'x-amzn-RequestId': '3e3ad214-7356-536b-8342-88753f3af4f7',
'Date': 'Tue, 18 Jan 2022 23:15:56 GMT',
'Content-Type': 'text/xml',
'Content-Length': '334',
}
```
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
PROVIDER_OVERRIDE_SQS=asf DEBUG=1 python -m localstack.cli.main start --host
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```
aws --endpoint-url="http://localhost:4566" sqs create-queue --queue-name MyQueue
aws --debug --endpoint-url="http://localhost:4566" sqs change-message-visibility --queue-url http://localhost:4566/000000000000/MyQueue --receipt-handle garbage --visibility-timeout 30
```
### Environment
```markdown
- OS: Linux Mint 20
- LocalStack: latest
```
### Anything else?
Not sure this is really the root cause of #5293, but worth investigating and fixing regardless. | https://github.com/localstack/localstack/issues/5297 | https://github.com/localstack/localstack/pull/5298 | 66b44fd84a444edd52edd0fc37ac7ff79e721f6f | ce0bef58f157d6ac16e6fdf3a5bd5cbec2780fab | 2022-01-18T23:05:18Z | python | 2022-01-20T16:43:31Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,293 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py"] | bug: SQS ChangeMessageVisibility Error Response Does Not Match AWS and Locks Up .NET Client | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When using the image localstack/localstack:0.13.3
1. When calling SQS **ChangeMessageVisibility** with a receipt handle that is not properly formatted, the error response is `ReceiptHandleIsInvalid`. (_This is correct behavior_.)
2. When calling SQS **ChangeMessageVisibility** with a receipt handle that is properly formatted but does not actually exist, the error response is `ReceiptHandleIsInvalid`.
3. When using the AWS .NET SDK with either of the above, the SDK code goes into an infinite loop trying to parse the error response.
### Expected Behavior
1. When calling SQS **ChangeMessageVisibility** with a receipt handle that is not properly formatted, the error response should be `ReceiptHandleIsInvalid`.
2. When calling SQS **ChangeMessageVisibility** with a receipt handle that is properly formatted but does not actually exist, the error response should be `InvalidParameterValue`.
3. When using the AWS .NET SDK with either of the above, the SDK code should not go into an infinite loop trying to parse the error response.
### How are you starting LocalStack?
Custom (please describe below)
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
If used the [Ductus.FluentDocker](https://github.com/mariotoffia/FluentDocker) library to create the container. I believe in the end it uses `docker run`. The actual image that was used is localstack/localstack:0.13.3
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
(I did not use `awslocal` but rather `aws --endpoint-url=...`. I hope that's OK. :-)
Here is the repro with LocalStack:
```
C:\>aws --endpoint-url="http://localhost:4566" sqs create-queue --queue-name MyQueue
{
"QueueUrl": "http://localhost:4566/000000000000/MyQueue"
}
C:\>aws --endpoint-url="http://localhost:4566" sqs send-message --queue-url http://localhost:4566/000000000000/MyQueue --message-body "{}"
{
"MD5OfMessageBody": "99914b932bd37a50b983c5e7c90ae93b",
"MessageId": "e1a53d04-fc0e-4a87-fa0c-85291ab017ac"
}
C:\>aws --endpoint-url="http://localhost:4566" sqs receive-message --queue-url http://localhost:4566/000000000000/MyQueue
{
"Messages": [
{
"MessageId": "e1a53d04-fc0e-4a87-fa0c-85291ab017ac",
"ReceiptHandle": "pjkzjurnqzvcrvusgkcnxclzkszvipcfifkaukrltjsjcfsjicagkqbxvwmzrresvdvqanbbqueqxelfvvfuubuhnutgtyyyseswmgobmkdejggkmxmskmmhjqxywhscfecrspsncaimlumjxvcbhksudipxqvwkqgkfrrnypdcdbdldoejonkpvg",
"MD5OfBody": "99914b932bd37a50b983c5e7c90ae93b",
"Body": "{}"
}
]
}
C:\>aws --endpoint-url="http://localhost:4566" sqs delete-message --queue-url http://localhost:4566/000000000000/MyQueue --receipt-handle pjkzjurnqzvcrvusgkcnxclzkszvipcfifkaukrltjsjcfsjicagkqbxvwmzrresvdvqanbbqueqxelfvvfuubuhnutgtyyyseswmgobmkdejggkmxmskmmhjqxywhscfecrspsncaimlumjxvcbhksudipxqvwkqgkfrrnypdcdbdldoejonkpvg
C:\>aws --endpoint-url="http://localhost:4566" sqs change-message-visibility --queue-url http://localhost:4566/000000000000/MyQueue --receipt-handle pjkzjurnqzvcrvusgkcnxclzkszvipcfifkaukrltjsjcfsjicagkqbxvwmzrresvdvqanbbqueqxelfvvfuubuhnutgtyyyseswmgobmkdejggkmxmskmmhjqxywhscfecrspsncaimlumjxvcbhksudipxqvwkqgkfrrnypdcdbdldoejonkpvg --visibility-timeout 30
An error occurred (ReceiptHandleIsInvalid) when calling the ChangeMessageVisibility operation: The input receipt handle is invalid.
C:\>aws --endpoint-url="http://localhost:4566" sqs change-message-visibility --queue-url http://localhost:4566/000000000000/MyQueue --receipt-handle garbage --visibility-timeout 30
An error occurred (ReceiptHandleIsInvalid) when calling the ChangeMessageVisibility operation: The input receipt handle is invalid.
```
Here is the repro with real AWS. My queue was created with the AWS console.
```
C:\>aws sqs send-message --queue-url <my-queue-url> --message-body "{}"
{
"MD5OfMessageBody": "99914b932bd37a50b983c5e7c90ae93b",
"MessageId": "645cb14e-6cc2-40e8-a934-bf5b82bf8169"
}
C:\>aws sqs receive-message --queue-url <my-queue-url>
{
"Messages": [
{
"MessageId": "645cb14e-6cc2-40e8-a934-bf5b82bf8169",
"ReceiptHandle": "AQEBRv9C815p34ggarmRAxrMMpvTA4U9e5GjQmqOQTWnO9QfCzzJaJ6sCzEfpyrXBTpdSTBbrBbKduvyonWS6TPbNagBwKMjIBKtA7sKv4P+/vJI0/0mX/Fc4jyPjzOrYaxs7IMACKmotNWgP1nrFQ3MUHIMzRVG3QNqmb3awA0g6S22QJDH85gSUqgGUNUt8IiTwW7wVdS1T4vVRnLtKhl0IMzvEJfsPHjbQU7uTrD8OmzbleegHjb4/Q4ibnxemoEtRutRlxGuP6j+FtLsrR6m8x2H6rdL1jeZBf831QQCFr1lH8qfkVhaz6AJpbYB0R1L/JRkbWxpbyIItSV1rA0I3WipGStr/5EGGM+Fmq4rJf2m/krcrWZVV20oJJNc9nNH19RB+xxN2cLBjXG/02OHmm8Kg8tfYD2D5FQ951Pgi0s=",
"MD5OfBody": "99914b932bd37a50b983c5e7c90ae93b",
"Body": "{}"
}
]
}
C:\>aws sqs delete-message --queue-url <my-queue-url> --receipt-handle AQEBRv9C815p34ggarmRAxrMMpvTA4U9e5GjQmqOQTWnO9QfCzzJaJ6sCzEfpyrXBTpdSTBbrBbKduvyonWS6TPbNagBwKMjIBKtA7sKv4P+/vJI0/0mX/Fc4jyPjzOrYaxs7IMACKmotNWgP1nrFQ3MUHIMzRVG3QNqmb3awA0g6S22QJDH85gSUqgGUNUt8IiTwW7wVdS1T4vVRnLtKhl0IMzvEJfsPHjbQU7uTrD8OmzbleegHjb4/Q4ibnxemoEtRutRlxGuP6j+FtLsrR6m8x2H6rdL1jeZBf831QQCFr1lH8qfkVhaz6AJpbYB0R1L/JRkbWxpbyIItSV1rA0I3WipGStr/5EGGM+Fmq4rJf2m/krcrWZVV20oJJNc9nNH19RB+xxN2cLBjXG/02OHmm8Kg8tfYD2D5FQ951Pgi0s=
C:\>aws sqs change-message-visibility --queue-url <my-queue-url> --receipt-handle AQEBRv9C815p34ggarmRAxrMMpvTA4U9e5GjQmqOQTWnO9QfCzzJaJ6sCzEfpyrXBTpdSTBbrBbKduvyonWS6TPbNagBwKMjIBKtA7sKv4P+/vJI0/0mX/Fc4jyPjzOrYaxs7IMACKmotNWgP1nrFQ3MUHIMzRVG3QNqmb3awA0g6S22QJDH85gSUqgGUNUt8IiTwW7wVdS1T4vVRnLtKhl0IMzvEJfsPHjbQU7uTrD8OmzbleegHjb4/Q4ibnxemoEtRutRlxGuP6j+FtLsrR6m8x2H6rdL1jeZBf831QQCFr1lH8qfkVhaz6AJpbYB0R1L/JRkbWxpbyIItSV1rA0I3WipGStr/5EGGM+Fmq4rJf2m/krcrWZVV20oJJNc9nNH19RB+xxN2cLBjXG/02OHmm8Kg8tfYD2D5FQ951Pgi0s= --visibility-timeout 30
An error occurred (InvalidParameterValue) when calling the ChangeMessageVisibility operation: Value AQEBRv9C815p34ggarmRAxrMMpvTA4U9e5GjQmqOQTWnO9QfCzzJaJ6sCzEfpyrXBTpdSTBbrBbKduvyonWS6TPbNagBwKMjIBKtA7sKv4P+/vJI0/0mX/Fc4jyPjzOrYaxs7IMACKmotNWgP1nrFQ3MUHIMzRVG3QNqmb3awA0g6S22QJDH85gSUqgGUNUt8IiTwW7wVdS1T4vVRnLtKhl0IMzvEJfsPHjbQU7uTrD8OmzbleegHjb4/Q4ibnxemoEtRutRlxGuP6j+FtLsrR6m8x2H6rdL1jeZBf831QQCFr1lH8qfkVhaz6AJpbYB0R1L/JRkbWxpbyIItSV1rA0I3WipGStr/5EGGM+Fmq4rJf2m/krcrWZVV20oJJNc9nNH19RB+xxN2cLBjXG/02OHmm8Kg8tfYD2D5FQ951Pgi0s= for parameter ReceiptHandle is invalid. Reason: Message does not exist or is not available for visibility timeout change.
C:\>aws sqs change-message-visibility --queue-url <my-queue-url> --receipt-handle garbage --visibility-timeout 30
An error occurred (ReceiptHandleIsInvalid) when calling the ChangeMessageVisibility operation: The input receipt handle "garbage" is not a valid receipt handle.
```
### Environment
```markdown
- OS: Windows 10.0.19044 Build 19044
- LocalStack: 0.13.3
```
Note that the "infinite loop" behavior I'm referring to seems to have been introduced with localstack 0.12.19. localstack 0.12.18 does not exhibit the "infinite loop" behavior. The "not matching AWS" behavior is in all the versions I tested.
### Anything else?
There are two main parts to this:
### Incorrect Error Response
This [AWS Java SDK issue](https://github.com/aws/aws-sdk-java/issues/1628) explains the two different error responses for **ChangeMessageVisibility**. "Invalid" is a tricky word here. I've referred to the first error as "not properly formatted". What I mean is that receipt handles are normally really long strings (for real AWS they appear to be base64 strings). So we know a string like "garbage" is not a real receipt handle. That's what AWS means by "invalid". But you could have a "properly formatted" receipt handle that's still not a real receipt handle. For example, the receipt handle for a message that's previously been deleted. That's how I reproduce this issue.
We have some production code that depends on this behavior. We have a race condition between code that deletes messages and code that changes the visibility on messages. This bug in LocalStack means I cannot integration test this code.
### Infinite Loop in .NET SDK
In the AWS .NET SDK, error responses are unmarshalled by two key classes for our purposes: [ErrorResponseUnmarshaller](https://github.com/aws/aws-sdk-net/blob/475822dec5e87954b7a47ac65995714ae1f1b115/sdk/src/Core/Amazon.Runtime/Internal/Transform/ErrorResponseUnmarshaller.cs) and [XmlUnmarshallerContext](https://github.com/aws/aws-sdk-net/blob/475822dec5e87954b7a47ac65995714ae1f1b115/sdk/src/Core/Amazon.Runtime/Internal/Transform/UnmarshallerContext.cs).
The code expects the XML response to be formatted in a certain way. In particular, it does not seem to deal with whitespace between elements. If whitespace is present in the wrong place in the XML, it goes into an infinite loop. I found this by cloning the AWS .NET SDK and fiddling their SQS unit tests and stepping through the client code.
Here is the response XML from real AWS:
```
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>ReceiptHandleIsInvalid</Code><Message>The input receipt handle "garbage" is not a valid receipt handle.</Message><Detail/></Error><RequestId>bd34a56b-d17a-552a-b343-ff0b22169609</RequestId></ErrorResponse>
```
Note how there are no newlines or spaces.
Here is the response XML from LocalStack:
```
<?xml version="1.0" encoding="UTF-8"?>
<ErrorResponse>
<Errors>
<Error>
<Code>ReceiptHandleIsInvalid</Code>
<Message><![CDATA[The input receipt handle is invalid.]]></Message>
</Error>
</Errors>
<RequestId>03D34ALJ80TB0D5YUQ9IBUAOTFSYZN74Y5S20JRFIPICJ0SNSW7T</RequestId>
</ErrorResponse>
```
Note how there are newlines and indenting. What looks like a blank line actually had eight spaces on it. The .NET code seems to fail due to that line with the eight spaces.
| https://github.com/localstack/localstack/issues/5293 | https://github.com/localstack/localstack/pull/6103 | 28a6cb490cc30efe2050542ed1b70d1982f87236 | c4a85ca3eaf4bfd008edf484dcf520dc9714110f | 2022-01-18T17:32:46Z | python | 2022-05-20T17:59:13Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,283 | ["localstack/services/awslambda/event_source_listeners/sqs_event_source_listener.py", "localstack/services/awslambda/lambda_executors.py", "localstack/testing/snapshots/transformer_utility.py", "localstack/utils/aws/dead_letter_queue.py", "localstack/utils/aws/message_forwarding.py", "tests/integration/awslambda/functions/lambda_sqs_integration.py", "tests/integration/awslambda/test_lambda_integration.py", "tests/integration/awslambda/test_lambda_sqs_integration.py", "tests/integration/awslambda/test_lambda_sqs_integration.snapshot.json", "tests/integration/test_sqs.py"] | bug: RedrivePolicy is not respected for SQS and Lambda integration | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
If the Lambda returns an error, the message is put into DLQ straightaway after first try **although** the configurations says "try 3 times".
### Expected Behavior
If the Lambda returns an error, the message should be put into DLQ after what `RedrivePolicy.maxReceiveCount` says which is 3 in this case. For instance, try processing the message 3 times, if still no success, put it into DLQ.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
```yaml
version: "3.8"
services:
localstack:
image: "localstack/localstack"
container_name: "localstack"
ports:
- "4566-4599:4566-4599"
environment:
- DEBUG=1
- DEFAULT_REGION=eu-west-1
- SERVICES=lambda,events,sqs
- DATA_DIR=/tmp/localstack/data
- DOCKER_HOST=unix:///var/run/docker.sock
- LAMBDA_EXECUTOR=docker
volumes:
- "./tmp/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
```
### Environment
```markdown
- OS: MacOS BigSur
- LocalStack: `1dc090777b0c`
```
### Anything else?
This will try **only once** and put the message into DLQ after failure **although** the retry policy instructs for **3 retries**. This is the issue.
```bash
aws --profile localstack --endpoint-url http://localhost:4566 lambda create-function \
--function-name api-lambda \
--handler lambda/main \
--runtime go1.x \
--role api-role \
--zip-file fileb://lambda.zip
aws --profile localstack --endpoint-url http://localhost:4566 sqs create-queue \
--queue-name api-dead-letter-queue
aws --profile localstack --endpoint-url http://localhost:4566 sqs create-queue \
--queue-name api-queue \
--attributes '{"RedrivePolicy":"{\"deadLetterTargetArn\":\"arn:aws:sqs:eu-west-1:000000000000:api-dead-letter-queue\",\"maxReceiveCount\":\"3\"}"}'
aws --profile localstack --endpoint-url http://localhost:4566 lambda create-event-source-mapping \
--function-name api-lambda \
--event-source-arn arn:aws:sqs:eu-west-1:000000000000:api-queue
```
Use this command to test.
```bash
aws --profile localstack --endpoint-url http://localhost:4566 sqs send-message \
--queue-url http://localhost:4566/000000000000/api-queue \
--message-body '{"hello":"world"}'
```
----
FYI - This will try **indefinitely** (_30 sec in between_) until it succeeds because there is **no** retry policy set which is perfectly normal and expected behaviour.
```bash
aws --profile localstack --endpoint-url http://localhost:4566 lambda create-function \
--function-name api-lambda \
--handler lambda/main \
--runtime go1.x \
--role api-role \
--zip-file fileb://lambda.zip
aws --profile localstack --endpoint-url http://localhost:4566 sqs create-queue \
--queue-name api-dead-letter-queue
aws --profile localstack --endpoint-url http://localhost:4566 sqs create-queue \
--queue-name api-queue
aws --profile localstack --endpoint-url http://localhost:4566 lambda create-event-source-mapping \
--function-name api-lambda \
--event-source-arn arn:aws:sqs:eu-west-1:000000000000:api-queue
``` | https://github.com/localstack/localstack/issues/5283 | https://github.com/localstack/localstack/pull/6603 | b616e822955defc87ed5b94714055e1e2e2b7529 | 78886562bec467b6a7931e7757599a2f4f1aafa6 | 2022-01-16T16:56:30Z | python | 2022-08-08T21:33:44Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,269 | ["localstack/services/s3/presigned_url.py", "tests/integration/awslambda/functions/lambda_s3_integration_presign.js", "tests/integration/awslambda/functions/lambda_s3_integration_sdk_v2.js", "tests/integration/s3/test_s3.py"] | bug: Additional headers in S3 presigned URL doesn't work | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
TL;DR: When presigned URL contains one of `Content-MD5`, `X-AMZ-Server-Side-Encryption` headers or their combination, it does not work on localstack, but works in AWS.
The **presigned S3 URL feature** allows to **add additional headers** to the request when using the **Version 4** signature. These headers are then used in the signing mechanism and verified when such URL is used.
**Use case**: When generating an URL to PUT a file into S3 bucket using the `aws-sdk` Node.js API, I add the MD5 hash of the file-to-be-uploaded to ensure the integrity and say that server-side-encryption should be used. Note that these arguments are added through the native options of `aws-sdk` API:
```js
const s3 = new AWS.S3({
endpoint: 'http://localhost:4566',
signatureVersion: 'v4', // Required for the presigned URL functionality with extra headers
s3ForcePathStyle: true, // Do not use custom domains
});
const body = '123456';
const bodyMd5AsBase64 = '4QrcOUm6Wau+VuBX8g+IPg=='
const url = await s3.getSignedUrlPromise('putObject', {
Bucket: 'test-bucket',
Key: 'test-file',
Expires: 3600,
ServerSideEncryption: 'AES256', // Adds 'X-Amz-Server-Side-Encryption' in query string
ContentMD5: bodyMD5 // Adds 'Content-MD5' parameter in query string
});
// url: http://localhost:4566/testBucket/testFile
// ?Content-MD5=4QrcOUm6Wau%2BVuBX8g%2BIPg%3D%3D
// &X-Amz-Algorithm=AWS4-HMAC-SHA256
// &X-Amz-Credential=test%2F20220113%2Fus-east-1%2Fs3%2Faws4_request
// &X-Amz-Date=20220113T142952Z
// &X-Amz-Expires=3600
// &X-Amz-Signature=d219a729f06e37d40a136bb5fec777265b1b34e879f9e338d385b39a3760a14f
// &X-Amz-SignedHeaders=content-md5%3Bhost%3Bx-amz-server-side-encryption
// &x-amz-server-side-encryption=AES256
//
// NOTE X-Amz-SignedHeaders contains `content-md5` and `x-amz-server-side-encryption` keys as well
const result = await fetch(url, {
method: 'PUT',
body: body,
headers: {
'Content-Type': 'text/plain',
'Accept': 'application/json',
'Content-MD5': bodyMD5, // This is required, otherwise AWS refuses to accept the request
'x-amz-server-side-encryption': 'AES256' // This is optional, but AWS is okay when value is passed as both query argument and header with same value
},
});
```
This example shows few issues, which are present when trying to process various presigned requests in localstack, but work correctly in AWS. I try to list them one by one below:
**Issue 1: Allow X-AMZ-Server-Side-Encryption in query string**
Presigned URL query string contains `x-amz-server-side-encryption=AES256` and `X-Amz-Signed-Headers=host%3Bx-amz-server-side-encryption`
PUT request does not contain any extra headers.
Localstack fails to process the request. AWS works.
**Issue 2: Allow X-AMZ-Server-Side-Encryption in query string and PUT request header with same value**
Presigned URL query string contains `x-amz-server-side-encryption=AES256` and `X-Amz-Signed-Headers=host%3Bx-amz-server-side-encryption`
PUT request does contains extra header `x-amz-server-side-encryption=AES256`.
Localstack fails to process the request. AWS works.
**Issue 3: Allow Content-MD5 in query string and PUT request header with same value**
Presigned URL query string contains `Content-MD5=...` and `X-Amz-Signed-Headers=content-md5%3Bhost`
PUT request does contains extra header `Content-MD5=...`.
Localstack fails to process the request. AWS works.
**Issue 4: Allow Content-MD5 and X-AMZ-Server-Side-Encryption in same request**
Combination of issues above. Localstack fails to process the request. AWS works.
### Expected Behavior
_No response_
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
I spin up the localstack docker with arguments below. Just noting that in its simple form, I was able to generate and successfully verify the presigned requests; so it's not an issue of invalid configuration.
```
S3_SKIP_SIGNATURE_VALIDATION=0
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test`
```
1. Assume you have running Node.js (tested on v12) and Docker.
2. Extract archive [presigned-urls-test.zip](https://github.com/localstack/localstack/files/7863686/presigned-urls-test.zip) and `cd` to this folder
3. `npm install` to install the `aws-sdk` dependency
3. `npm run docker` to spin up the localstack. It will listen on `localhost:4566`
4. `npm run test` to run the test
5. The file should end up with `200` response code in output, but it fails on `403` signature mismatch.
### Environment
```markdown
- OS: Ubuntu 20.04
- Localstack: 0.13.3
- Node.js: 12
- Docker
```
### Anything else?
Signature V4 specification: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
It seems to me the error is somewhere inside `authenticate_presign_url` method in here
https://github.com/localstack/localstack/blob/a400de0982487df33ae7c7cfc6d255839a03d91e/localstack/services/s3/s3_utils.py#L220-L253
I am not a Python developer, but I have suspicion, that:
* `X-Amz-SignedHeaders` query argument is not parsed to see which extra headers should be included for the signature verification, resulting in `Content-MD5` being skipped
* there is something strange when header with same value is present in both query string and request headers (such as the `Content-MD5` that is neccessary to pass in both, or `X-Amz-Server-Side-Encryption`, that is neccessary to be just in the query string, but AWS allows it to be ALSO in request headers with same value)
Maybe my assumptions are wrong, I was not investigating the code that much.
Hopefully this helps to describe the issue. I know that | https://github.com/localstack/localstack/issues/5269 | https://github.com/localstack/localstack/pull/7628 | e0e0a268a894edc7f986823448cd1767eb7b511b | ed228d7e53adf401be4a8ccc97e74324839e02b7 | 2022-01-13T15:07:31Z | python | 2023-02-07T14:28:29Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,248 | ["localstack/services/sqs/provider.py", "tests/integration/test_sqs.py", "tests/integration/test_sqs.snapshot.json", "tests/unit/aws/protocol/test_serializer.py"] | MessageAttributes can't be set on SQS message | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When a new message is created with attributed, message: `{QueueUrl: http://localhost:32921/000000000000/c2e89862-2dd2-48a2-aba7-3948660eaea7,MessageBody: Test msg,DelaySeconds: 0,MessageAttributes: {retryCount={StringValue: 3,StringListValues: [],BinaryListValues: [],DataType: NUMBER}, timeToConsume={StringValue: 0,StringListValues: [],BinaryListValues: [],DataType: NUMBER}},MessageSystemAttributes: {},}`
it fails to get published in the queue with exception: `com.amazonaws.services.sqs.model.AmazonSQSException: null (Service: AmazonSQS; Status Code: 400; Error Code: 400 ; Request ID: BDFBJI2A19T0WXE9J2GSPA0GO7MGIEOYBTVCCW4L2Z1W1UK6CX8A; Proxy: null)`
**Note: It is published successfully when I remove all attributes**
### Expected Behavior
Publish successfully in the queue
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```
private static final DockerImageName DOCKER_IMAGE_NAME = DockerImageName.parse("localstack/localstack");
private static final String DEFAULT_TAG = "0.13.3";
private final DockerImageName LOCAL_STACK_IMAGE = DOCKER_IMAGE_NAME.withTag(DEFAULT_TAG);
localstack = new LocalStackContainer(LOCAL_STACK_IMAGE)
.withServices(localStackService);
localstack.start();
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
#### Creating queue:
```
public String createQueue(String queueName) {
log.info("Creating queue with name: {}", queueName);
try {
CreateQueueRequest createQueueRequest = new CreateQueueRequest(queueName);
return amazonSQS.createQueue(createQueueRequest).getQueueUrl();
} catch (AmazonSQSException e) {
log.error("Error While Creating Queue: {}", ExceptionUtils.getStackTrace(e));
throw e;
}
}
```
Publish In Queue:
```
public SendMessageResult publishInQueue(final String queueUrl, final PublishRequestMessage message) throws SQSPublisherException {
log.info("Publishing Message: {}, in the queue: {}", message.getMessage(), queueUrl);
try {
final SendMessageRequest request = getSendMessageRequest(queueUrl, message.getMessage(), message.getMessageProperties());
return amazonSQS.sendMessage(request);
} catch (Exception ex) {
throw new SQSPublisherException("Exception while queuing message: " + message + " ,exception: " + ex);
}
}
private SendMessageRequest getSendMessageRequest(final String queueUrl,
final String message,
MessageProperties messageProperties) throws SQSPublisherException {
messageProperties = handleEmptyProperties(messageProperties);
Long timeToConsume = messageProperties.getTimeToConsumeMessage();
Integer deliveryDelay = messageProperties.getDeliveryDelay();
Integer retryCount = messageProperties.getRetryCount();
try {
final SendMessageRequest request = new SendMessageRequest(queueUrl, message)
.withMessageAttributes(Collections.unmodifiableMap(
getAttributeValueMap(Objects.nonNull(timeToConsume) ? timeToConsume : TIME_TO_CONSUME,
Objects.nonNull(retryCount) ? retryCount : RETRY_COUNT)
));
int delay = getAllowedDelay(Objects.nonNull(deliveryDelay) ? deliveryDelay : DELIVERY_DELAY);
request.setDelaySeconds(delay);
return request;
} catch (Exception e) {
throw new SQSPublisherException("Error While Creating Message Request" + e);
}
}
private Map<String, MessageAttributeValue> getAttributeValueMap(final long timeToConsume, final long retryCount) {
Map<String, MessageAttributeValue> attributeValueMap = new HashMap<>();
attributeValueMap.put(MessageProperty.RETRY.getDescription(),
getAttributeValue(SQSAttributeDataType.NUMBER, String.valueOf(retryCount)));
attributeValueMap.put(MessageProperty.TIME_TO_CONSUME.getDescription(),
getAttributeValue(SQSAttributeDataType.NUMBER, String.valueOf(timeToConsume)));
return attributeValueMap;
}
```
### Environment
```markdown
- OS: macOS Big Sur
- LocalStack: 0.13.3
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5248 | https://github.com/localstack/localstack/pull/6097 | 7ebc44cd4f2b846c7e8aa3fefc771c5ae2a1e3b2 | fa4dcf9716abecd05805a9f61b787b3c5f4db596 | 2022-01-10T17:34:11Z | python | 2022-05-19T17:34:53Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,233 | ["localstack/constants.py", "localstack/services/install.py", "localstack/services/kms/kms_starter.py"] | bug: Missing support for local-kms provider on arm64 | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
The KMS provider `local-kms` don't start on Apple M1 ( arm64 ).
### Expected Behavior
Localstack should use `darwin-arm64` build of `local-kms`.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run -e KMS_PROVIDER=local-kms localstack/localstack
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal kms list-aliases
### Environment
```markdown
- OS: OSX 12.0.1 ( Apple M1 Pro )
- LocalStack: 0.13.2
```
### Anything else?
Pull request in preparation | https://github.com/localstack/localstack/issues/5233 | https://github.com/localstack/localstack/pull/5234 | 0b49f5b1ec6cab42b88d19341b0e6c68b739d610 | 06cf807f86b26dabb9870a87b99e218ba9ec16c2 | 2022-01-06T13:28:28Z | python | 2022-01-17T08:22:57Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,226 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/services/apigateway/helpers.py"] | bug: HTTP Proxy integrations take more specificity than explicitly defined resources | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I'm trying to use the HTTP_PROXY feature to provide a fallback to an old API whilst the endpoints are replaced with API GW + Lambda.
I currently have an API Gateway set up similar to the following:
```
/resource
/{proxy+}
ANY -> HTTP_PROXY
/test
GET -> AWS_PROXY -> Lambda
```
When I do a request to `http://localhost:4566/restapis/uslhbxmpgd/v1/_user_request_/resource/test` the `{proxy+}` resource catches the request.
I have tested the configuration in AWS and this behaviour isn't present. The `/test` catches the request and forwards an event through to the Lambda Integration.
### Expected Behavior
`{proxy+}` to have lowest possible specificity if other resources are defined at the same level, meaning it should only catch requests that don't have another matching resource.
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
localstack start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
I'm using terraform to configure the environments:
```hcl
resource "aws_api_gateway_resource" "resource" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_rest_api.api.root_resource_id
path_part = "resource"
}
resource "aws_api_gateway_resource" "fallback-proxy-resource" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_resource.resource.id
path_part = "{proxy+}"
}
resource "aws_api_gateway_method" "fallback-proxy-method" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.fallback-proxy-resource.id
http_method = "ANY"
authorization = "NONE"
request_parameters = {
"method.request.path.proxy" = true
"method.request.header.authorization" = false
}
}
resource "aws_api_gateway_integration" "fallback-proxy-method-integration" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.fallback-proxy-resource.id
http_method = aws_api_gateway_method.fallback-proxy-method.http_method
type = "HTTP_PROXY"
integration_http_method = "ANY"
uri = "https://httpbin.org/anything/{proxy}"
request_parameters = {
"integration.request.path.proxy" = "method.request.path.proxy"
"integration.request.header.authorization" = "method.request.header.authorization"
}
}
resource "aws_api_gateway_resource" "test-resource" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_resource.resource.id
path_part = "test"
}
resource "aws_api_gateway_method" "test-GET-method" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.test-resource.id
http_method = "GET"
authorization = "NONE"
}
resource "aws_api_gateway_integration" "test-GET-method-integration" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.test-resource.id
http_method = aws_api_gateway_method.test-GET-method.http_method
integration_http_method = "POST"
type = "AWS_PROXY"
uri = "arn..."
}
```
### Environment
```markdown
- OS: macOS 12.0.1
- LocalStack: 0.13.3 and 0.13.2
```
### Anything else?
I've tested using versions pre and post the fix for other HTTP proxy issues by @calvernaz in #5212 and it doesn't seem to be related. | https://github.com/localstack/localstack/issues/5226 | https://github.com/localstack/localstack/pull/5257 | ec8b72d5c926ae8495ca50ce168494247aef54be | 35c302e1e1b1284874a162e48ecbc82a01d5e564 | 2022-01-05T15:48:32Z | python | 2022-01-12T11:45:37Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,204 | ["localstack/services/stepfunctions/resource_providers/aws_stepfunctions_statemachine.py", "tests/aws/services/stepfunctions/v2/test_sfn_api.py", "tests/aws/services/stepfunctions/v2/test_sfn_api.snapshot.json"] | bug: StateMachine yaml Definition is not supported (DefinitionString works) | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
when describing using cloudformation YAML with Definition, LocalStack fails to create StateMachine. Switching to YAML with DefinitionString works as expected.
Examples taken from here
https://docs.aws.amazon.com/step-functions/latest/dg/development-options.html#development-options-format
Attaching working example
[localstack_stepfunctions_and_serverless.zip](https://github.com/localstack/localstack/files/7791134/localstack_stepfunctions_and_serverless.z
### Expected Behavior
YAML with Definition is much more preferable in a complex state machine description with bunch of substitutions, references and parameters
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
localstack --debug start -d
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal s3 mb s3://s4-echo-serverless-deployment-share-local
sls deploy --stage local
### Environment
```markdown
- OS: OSX Monterey
- LocalStack: latest
```
### Anything else?
Error when using YAML with Definition
[error.txt](https://github.com/localstack/localstack/files/7791149/error.txt)
Success when using YAML with DefinitionString
[success.txt](https://github.com/localstack/localstack/files/7791151/success.txt)
| https://github.com/localstack/localstack/issues/5204 | https://github.com/localstack/localstack/pull/9677 | 61d66a972603adbb6a49e83901a2022dcff8f36a | 9bb14ea1d0e321dd49570651640a120117ed90cd | 2021-12-30T01:09:42Z | python | 2023-11-27T08:29:31Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,193 | ["localstack/config.py"] | bug: PROVIDER_OVERRIDE_<provider> env vars are not passed through with the CLI | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Starting localstack with the CLI `PROVIDER_OVERRIDE_SQS=asf bin/localstack --debug start` starts up correctly but then uses the `default` SQS provider.
### Expected Behavior
I would expect it to start the asf provider.
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
* `PROVIDER_OVERRIDE_SQS=asf bin/localstack --debug start`
* `awslocal sqs create-queue --queue-name "test-queue"`
logs show:
```
2021-12-27T14:08:43.274:DEBUG:plugin.manager: instantiating plugin PluginSpec(localstack.aws.provider.sqs:default = <function sqs at 0x7f30e6d2b820>)
2021-12-27T14:08:43.274:DEBUG:plugin.manager: loading plugin localstack.aws.provider:sqs:default
2021-12-27T14:08:43.278:INFO:localstack.services.infra: Starting mock SQS service on http port 4566 ...
2021-12-27T14:08:43.279:INFO:localstack.services.infra: Starting mock SQS service on http port 4566 ...
2021-12-27T14:08:43.279:INFO:localstack.services.motoserver: starting moto server on http://0.0.0.0:38335
```
### Environment
```markdown
- OS: Ubuntu 20.04
- LocalStack: 13.2
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5193 | https://github.com/localstack/localstack/pull/5194 | 390f01dc69d9634665365357a314e3c5bf3dff8d | 896c90613fb6ccad33f09a95b617a6cb2c293be1 | 2021-12-27T14:12:56Z | python | 2021-12-27T18:39:12Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,130 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/services/apigateway/context.py"] | bug: fails to invoke lambda in docker | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I'm using localstack in docker-compose to test a lambda function. The lambda is in a docker image and gets triggered when a file is uploaded to s3.
Here is the localstack docker-compose setup
```yml
localstack:
image: localstack/localstack:latest
ports:
- 4566:4566
environment:
SERVICES: s3,sns,lambda,iam
AWS_DEFAULT_REGION: us-west-2
LAMBDA_EXECUTOR: docker-reuse
LAMBDA_REMOVE_CONTAINERS: 0
LOCALSTACK_API_KEY: ${LOCALSTACK_API_KEY}
volumes:
- ./localstack-init-scripts:/docker-entrypoint-initaws.d
- "/var/run/docker.sock:/var/run/docker.sock"
```
And here is the localstack error that happens when the lambda is triggered.
```bash
localstack_1 | 2021-12-15T20:09:24.960:ERROR:localstack_ext.services.awslambda.lambda_extended: Unable to invoke Lambda "arn:aws:lambda:us-west-2:000000000000:function:kb-service-upload-handler":
localstack_1 | Traceback (most recent call last):
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/docker/api/client.py", line 268, in _raise_for_status
localstack_1 | response.raise_for_status()
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
localstack_1 | raise HTTPError(http_error_msg, response=self)
localstack_1 | requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/containers/cea0db10eafcec866aaedb6d45048e060f978d44843dae4e9282a1fb75340837/start
localstack_1 |
localstack_1 | During handling of the above exception, another exception occurred:
localstack_1 |
localstack_1 | Traceback (most recent call last):
localstack_1 | File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1413, in start_container
localstack_1 | container.start()
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/docker/models/containers.py", line 404, in start
localstack_1 | return self.client.api.start(self.id, **kwargs)
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/docker/utils/decorators.py", line 19, in wrapped
localstack_1 | return f(self, resource_id, *args, **kwargs)
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/docker/api/container.py", line 1111, in start
localstack_1 | self._raise_for_status(res)
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/docker/api/client.py", line 270, in _raise_for_status
localstack_1 | raise create_api_error_from_http_exception(e)
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
localstack_1 | raise cls(e, response=response, explanation=explanation)
localstack_1 | docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/containers/cea0db10eafcec866aaedb6d45048e060f978d44843dae4e9282a1fb75340837/start: Bad Request ("OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/tmp/e965911c.sh": stat /tmp/e965911c.sh: no such file or directory: unknown")
localstack_1 |
localstack_1 | During handling of the above exception, another exception occurred:
localstack_1 |
localstack_1 | Traceback (most recent call last):
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/localstack_ext/services/awslambda/lambda_extended.py.enc", line 458, in do_run_lambda_executor
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/localstack_ext/services/awslambda/lambda_launcher.py.enc", line 343, in docker_reuse_execute_in_container
localstack_1 | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/localstack_ext/services/awslambda/lambda_launcher.py.enc", line 242, in custom_image_execute_in_container
localstack_1 | File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1541, in run_container
localstack_1 | result = self.start_container(
localstack_1 | File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1418, in start_container
localstack_1 | raise ContainerException()
localstack_1 | localstack.utils.docker_utils.ContainerException
localstack_1 | 2021-12-15T20:09:24.960:INFO:localstack_ext.services.awslambda.lambda_extended: Lambda container output: None
localstack_1 | None
```
The lambda is getting created like this
```bash
awslocal lambda create-function \
--function-name kb-service-upload-handler \
--code ImageUri=kb-service-upload-handler \
--role arn:aws:iam::000000000000:role/test \
--handler "src.upload_handler.main.handler" \
--package-type Image
```
It appears the code inside the lambda never gets invoked.
### Expected Behavior
The lambda should be invoked successfully.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
```
docker-compose up
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```
awslocal lambda create-function \
--function-name kb-service-upload-handler \
--code ImageUri=kb-service-upload-handler \
--role arn:aws:iam::000000000000:role/test \
--handler "src.upload_handler.main.handler" \
--package-type Image
awslocal s3api put-bucket-notification-configuration \
--bucket client-uploads \
--notification-configuration file://notification.json
```
### Environment
```markdown
- OS: Ubuntu
- LocalStack: latest
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5130 | https://github.com/localstack/localstack/pull/5837 | 5b2633c5cdc97bbde2b30f7058e7d91220f1b494 | d2ffa1fbfa0f9e869b4fcdc209247a79988e433a | 2021-12-15T20:17:39Z | python | 2022-04-11T12:42:04Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,125 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/utils/http_utils.py", "tests/integration/test_api_gateway.py", "tests/unit/test_apigateway.py", "tests/unit/test_http_utils.py"] | bug: Query params not forwarded when using HTTP Proxy with API Gateway REST API | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I am trying to build an API Gateway HTTP Proxy fallback for a REST API. I have the following API Gateway resources configured locally with localstack.
```json
{
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"requestParameters": {
"method.request.path.proxy": true
},
"methodIntegration": {
"type": "HTTP_PROXY",
"httpMethod": "ANY",
"uri": "https://httpbin.org/anything/{proxy}",
"requestParameters": {
"integration.request.path.proxy": "method.request.path.proxy"
},
"passthroughBehavior": "WHEN_NO_MATCH",
"timeoutInMillis": 29000,
"cacheNamespace": "9b6e854f",
"cacheKeyParameters": []
}
}
```
When I call this endpoint with `GET http://localhost:4566/restapis/vt7zvfoavm/local/_user_request_/foo/bar/baz?myParam=12345678` I receive the following response (Using [HTTPbin](https://httpbin.org/) here to return the request as the response)
```jsonc
{
"args": {}, // no query params in args
"data": "",
"files": {},
"form": {},
"headers": {
"--Apigw-Request-Region--": "eu-west-1",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Authorization": "AWS4-HMAC-SHA256 Credential=__internal_call__/20160623/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=1234",
"Host": "localhost",
"Postman-Token": "134b9852-7589-4a54-b730-5444588ae024",
"Remote-Addr": "172.17.0.1",
"User-Agent": "PostmanRuntime/7.28.4",
"X-Amzn-Trace-Id": "Root=1-61b9bc31-6c2834ad38c63f456284cdd9",
"X-Localstack-Edge": "http://localhost:4566",
"X-Localstack-Tgt-Api": "apigateway"
},
"json": null,
"method": "GET",
"origin": "172.17.0.1, localhost:4566, 127.0.0.1, localhost:4566, 92.27.80.225",
"url": "https://localhost/anything/foo/bar/baz" // no query params on url
}
```
The query parameter `myParam=12345678` is stripped from the request, despite being a valid part of the `{proxy}` path.
I used the same configuration to create resources in AWS:
```json
{
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"requestParameters": {
"method.request.path.proxy": true
},
"methodIntegration": {
"type": "HTTP_PROXY",
"httpMethod": "ANY",
"uri": "https://httpbin.org/anything/{proxy}",
"connectionType": "INTERNET",
"requestParameters": {
"integration.request.path.proxy": "method.request.path.proxy"
},
"passthroughBehavior": "WHEN_NO_MATCH",
"timeoutInMillis": 29000,
"cacheNamespace": "445f0a",
"cacheKeyParameters": []
}
}
```
And the response is as expected:
```jsonc
// GET https://redacted.execute-api.eu-west-1.amazonaws.com/v1/foo/bar/baz?myParam=12345678
{
"args": {
"myParam": "12345678" // query param passed through
},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Cloudfront-Forwarded-Proto": "https",
"Cloudfront-Is-Desktop-Viewer": "true",
"Cloudfront-Is-Mobile-Viewer": "false",
"Cloudfront-Is-Smarttv-Viewer": "false",
"Cloudfront-Is-Tablet-Viewer": "false",
"Cloudfront-Viewer-Country": "GB",
"Host": "httpbin.org",
"Postman-Token": "41397d0f-d04b-4b39-8110-5a5d9684e86d",
"User-Agent": "PostmanRuntime/7.28.4",
"X-Amz-Cf-Id": "Sb6KMrHBuK0V1zyn9TdmKm0HreYhZrOmgHHec0mPD5jR0YjGpzDDEg==",
"X-Amzn-Apigateway-Api-Id": "redacted",
"X-Amzn-Trace-Id": "Self=1-61b9be60-5a0d8f4d09b8f5c554bbe723;Root=1-61b9be5f-37e6655166d36d2a4b330d4f"
},
"json": null,
"method": "GET",
"origin": "92.27.80.225, 130.176.222.55, 108.128.160.192",
"url": "https://httpbin.org/anything/foo/bar/baz?myParam=12345678" // query param on url
}
```
I have also tried explicitly mapping query parameters with `"integration.request.querystring.myParam": "method.request.querystring.myParam"`, this doesn't work and also doubles up the query param in the AWS environment.
### Expected Behavior
I expect query parameters to be passed through on HTTP_PROXY requests as they are in the AWS equivalent.
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
I'm using `localstack start`
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
I'm using Terraform to configure the environments:
```hcl
resource "aws_api_gateway_resource" "test-api-proxy-resource" {
rest_api_id = aws_api_gateway_rest_api.test-api.id
parent_id = aws_api_gateway_rest_api.test-api.root_resource_id
path_part = "{proxy+}"
}
resource "aws_api_gateway_method" "test-api-proxy-method" {
rest_api_id = aws_api_gateway_rest_api.test-api.id
resource_id = aws_api_gateway_resource.test-api-proxy-resource.id
http_method = "ANY"
authorization = "NONE"
request_parameters = {
"method.request.path.proxy" = true
}
}
resource "aws_api_gateway_integration" "test-api-proxy-method-integration" {
rest_api_id = aws_api_gateway_rest_api.test-api.id
resource_id = aws_api_gateway_resource.test-api-proxy-resource.id
http_method = aws_api_gateway_method.test-api-proxy-method.http_method
type = "HTTP_PROXY"
integration_http_method = "ANY"
uri = "https://httpbin.org/anything/{proxy}"
passthrough_behavior = "WHEN_NO_MATCH"
request_parameters = {
"integration.request.path.proxy" = "method.request.path.proxy"
}
}
```
I use `aws{local} apigateway get-method --rest-api-id <ID> --resource-id <ID> --http-method ANY` to get the configuration out of the environment.
### Environment
```markdown
- OS: macOS 12.0.1
- LocalStack: 0.13.1 and 0.13.0.11
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5125 | https://github.com/localstack/localstack/pull/5212 | 122722754c30e9ed5f2fe4c6f8926582b7b21e60 | f829aac7e2af1754eb7f70a1f7369ce5e17764ed | 2021-12-15T10:22:50Z | python | 2022-01-02T22:21:27Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,122 | ["localstack/services/apigateway/helpers.py", "tests/unit/test_apigateway.py"] | bug: Localstack does not properly handle apigateway proxy resources | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I have a number of lambda functions behind an API Gateway, each responsible for serving a small API. My stack is defined in CDK and deployed to localstack using cdklocal.
For each of the services mounted on the gateway, I have 2 integration defined. One for the root of the resource and another proxing any none-root requests into the same lambda.
My resources look like this:
```sh
> awslocal apigateway get-rest-apis
{
"items": [
{
"id": "lgvd3zqa8b",
"name": "TracktileBackendApiLocal",
"description": "",
"createdDate": "2021-12-14T18:16:08-04:00",
"version": "V1",
"binaryMediaTypes": [],
"apiKeySource": "HEADER",
"endpointConfiguration": {
"types": [
"EDGE"
]
},
"tags": {},
"disableExecuteApiEndpoint": false
}
]
}
> awslocal apigateway get-resources --rest-api-id lgvd3zqa8b
{
"items": [
{
"id": "f2zdoj6dmi",
"path": "/",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-CoreapiHandler25B88C23-ca16ca78/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "fecc94d8",
"cacheKeyParameters": []
}
}
}
},
{
"id": "wetl5415x6",
"parentId": "f2zdoj6dmi",
"pathPart": "{proxy+}",
"path": "/{proxy+}",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-CoreapiHandler25B88C23-ca16ca78/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "0da7cd80",
"cacheKeyParameters": []
}
}
}
},
{
"id": "ivgn3c0vcz",
"parentId": "f2zdoj6dmi",
"pathPart": "flow",
"path": "/flow",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-FlowapiHandler8606373F-4237e93b/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "a746819b",
"cacheKeyParameters": []
}
}
}
},
{
"id": "plotkhzk1u",
"parentId": "ivgn3c0vcz",
"pathPart": "{proxy+}",
"path": "/flow/{proxy+}",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-FlowapiHandler8606373F-4237e93b/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "d53a7f58",
"cacheKeyParameters": []
}
}
}
},
{
"id": "scpfu9z3l4",
"parentId": "f2zdoj6dmi",
"pathPart": "formulas",
"path": "/formulas",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-FormulaapiHandler4EC50B4-1db1cda1/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "2edb46e1",
"cacheKeyParameters": []
}
}
}
},
{
"id": "ehhukzlulm",
"parentId": "scpfu9z3l4",
"pathPart": "{proxy+}",
"path": "/formulas/{proxy+}",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-FormulaapiHandler4EC50B4-1db1cda1/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "8385d874",
"cacheKeyParameters": []
}
}
}
},
{
"id": "g0d4khz6zr",
"parentId": "f2zdoj6dmi",
"pathPart": "orders",
"path": "/orders",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-PurchaseOrderapiHandler4-1b5fc38d/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "aa1bb342",
"cacheKeyParameters": []
}
}
}
},
{
"id": "p3n7jxk9p4",
"parentId": "g0d4khz6zr",
"pathPart": "{proxy+}",
"path": "/orders/{proxy+}",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-PurchaseOrderapiHandler4-1b5fc38d/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "fa8379bd",
"cacheKeyParameters": []
}
}
}
},
{
"id": "1o403r2xzn",
"parentId": "f2zdoj6dmi",
"pathPart": "dashboards",
"path": "/dashboards",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-DashboardapiHandler67868-fea7c248/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "32beba39",
"cacheKeyParameters": []
}
}
}
},
{
"id": "p4gz9qbom2",
"parentId": "1o403r2xzn",
"pathPart": "{proxy+}",
"path": "/dashboards/{proxy+}",
"resourceMethods": {
"ANY": {
"httpMethod": "ANY",
"authorizationType": "NONE",
"apiKeyRequired": false,
"methodIntegration": {
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:000000000000:function:TracktileBackendLocal-DashboardapiHandler67868-fea7c248/invocations",
"requestParameters": {},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "2b449313",
"cacheKeyParameters": []
}
}
}
}
]
}
```
The following requests succeed against my gateway:
- `GET /`
- `GET /dashboards`
- `GET /flow`
- `GET /flow/{name}`
However, this path fails
- `GET /flow/{name}/positions`
With this error returned from the gateway:
```
{"Type": "User", "message": "Unable to find path /prod/flow/default/positions", "__type": "NotFoundException"}
```
For some reason this path fails. There is a path parameter in the middle of the path, but API Gateway is not aware of it, the entire path should be parsed and handled by my express application inside of the lambda.
As far as I can tell, localstack appears to throw this error when this function is unable to resolve the path to a resource: https://github.com/localstack/localstack/blob/7c4c7e611e412b36d62528fda61aa2f764ac94da/localstack/services/apigateway/apigateway_listener.py#L896
However, I don't know enough about API Gateway to try my hand at a PR.
### Expected Behavior
I expect the request to match the proxy resource and be handled by the correct lambda.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
- Deploy API Gateway resources matching above
### Environment
```markdown
Using `localstack/localstack:latest` as of the time of this issue.
# Environment
DATA_DIR=/tmp/localstack/data
EXTRA_CORS_ALLOWED_ORIGINS=http://localhost:3001
LAMBDA_EXECUTOR=docker-reuse
LAMBDA_REMOTE_DOCKER=false
LAMBDA_STAY_OPEN_MODE=1
LAMBDA_DOCKER_NETWORK=myapp_local
DYNAMODB_SHARE_DB=1
LS_LOG=trace
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5122 | https://github.com/localstack/localstack/pull/5217 | 1888e66b85d7e6a8ee457bc7a732984fcf7aa830 | afd3a85b637932a230a81163630695ecfad23879 | 2021-12-14T22:31:45Z | python | 2022-01-03T21:56:05Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,105 | ["localstack/services/apigateway/apigateway_listener.py"] | bug: Api Gateway Methodsettings | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Deploying a AWS Sam template to localstack via cloudformation results in an API Gateway deploy that does not invoke the function. Subsequently, all requests return an `Unable to find integration for: GET /foo/bar` error. If I specify `GET` for the lambda invocation eventsource method instead of `ANY`, requests go through, but I need to use `GET` and `PUT`.
### Expected Behavior
The specified lambda function should be invoked regardless of the HTTP method used.
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
DEBUG=1 localstack start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
sam build
samlocal deploy --resolve-s3 --capabilities CAPABILITY_IAM --stack-name $(PROJECT_NAME) --region us-east-1 -t .aws-sam/build/template.yaml
### Environment
```markdown
- OS: Linux (Ubuntu)
- LocalStack: 0.12.20
```
### Anything else?
`awslocal apigateway get-stages --rest-api-id=xxxxxxx`
```
{
"item": [
{
"deploymentId": "ccjq7wewws",
"stageName": "Stage",
"description": "",
"cacheClusterEnabled": false,
"methodSettings": {},
"variables": {}
},
{
"deploymentId": "ccjq7wewws",
"stageName": "test",
"description": "",
"cacheClusterEnabled": false,
"methodSettings": {},
"variables": {},
"tags": {}
}
]
}
```
rendered SAM template after sam build
```
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Runtime: go1.x
Environment:
Variables:
WORKSPACE: test
ENVIRONMENT: test
LOG_LEVEL: debug
Resources:
Api:
Type: AWS::Serverless::Function
Properties:
Handler: endorsements-api
FunctionName: endorsements-api
CodeUri: Api
Timeout: 30
Events:
AllEvents:
Type: Api
Properties:
Path: '{proxy+}'
Method: ANY
RestApiId:
Ref: ApiGateway
Metadata:
BuildMethod: makefile
ApiGateway:
Type: AWS::Serverless::Api
Name: endorsements-api-gateway
Properties:
Name: endorsements-api-gateway
StageName: test
MethodSettings:
- HttpMethod: *
ResourcePath: /*
Outputs:
ApiID:
Value:
Ref: ApiGateway
LocalURI:
Value:
Fn::Sub: http://localhost:4566/restapis/${ApiGateway}/test/_user_request_/docs/index.html
Endpoint:
Value:
Fn::Sub: https://${ApiGateway}.execute-api.${AWS::Region}.amazonaws.com/Prod/
```
`awslocal apigateway get-integrations --restapi-id=xxxxxx` shows there is an ANY style integration deployed, though it fails for all requests:
```
{
"items": [
{
"id": "3hocyhz56b",
"path": "{proxy+}",
"resourceMethods": {
"X-AMAZON-APIGATEWAY-ANY-METHOD": {
"httpMethod": "X-AMAZON-APIGATEWAY-ANY-METHOD",
"apiKeyRequired": false,
"methodIntegration": {
"type": "aws_proxy",
"httpMethod": "X-AMAZON-APIGATEWAY-ANY-METHOD",
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:000000000000:function:endorsements-api/invocations",
"requestTemplates": {},
"cacheNamespace": "84748f6c",
"cacheKeyParameters": [],
"integrationResponses": {
"200": {
"statusCode": 200,
"responseTemplates": {}
}
}
}
}
}
}
]
}
``` | https://github.com/localstack/localstack/issues/5105 | https://github.com/localstack/localstack/pull/5323 | 610924cb71beb49551a04e8d1dad747eb99c840f | af02c9013bf8d3f3e91da20e0ae02f23f9e79bf0 | 2021-12-09T23:21:30Z | python | 2022-01-21T09:51:24Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,096 | ["localstack/services/sns/sns_listener.py", "tests/integration/fixtures.py", "tests/integration/test_sns.py"] | bug: Publishing a message to SNS with empty body should fail | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When you publish a message to SNS without a *body* (e.g. only attributes) it succeeds.
### Expected Behavior
Trying to publish a message without a *body* should fail (at least it does when trying to do this in AWS)
### How are you starting LocalStack?
Custom (please describe below)
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
using Java testcontainers...
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```bash
#!/bin/sh
queue_arn=$(awslocal sqs create-queue --queue-name $QUEUE_NAME --output text)
echo "Queue ARN: $queue_arn"
topic_arn=$(awslocal sns create-topic --name $TOPIC_NAME --output text)
echo "Topic ARN: $topic_arn"
subscription_arn=$(awslocal sns subscribe \
--attributes RawMessageDelivery=true \
--topic-arn "$topic_arn" \
--protocol sqs \
--notification-endpoint "$queue_arn" \
--output text)
echo "Subscription ARN: $subscription_arn"
```
### Environment
```markdown
- OS: OSX 11.5.2
- LocalStack: 0.13.0
- Docker Desktop: v20.10.8
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5096 | https://github.com/localstack/localstack/pull/5106 | 31792d0df3485c6391c10a81da74134dd8663e26 | e57ff7e62e6706001532ace412c6bceb97132cd7 | 2021-12-08T14:52:50Z | python | 2021-12-10T20:33:32Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,091 | ["localstack/services/logs/provider.py", "localstack/testing/pytest/fixtures.py", "localstack/testing/snapshots/transformer.py", "localstack/testing/snapshots/transformer_utility.py", "tests/integration/test_logs.py", "tests/integration/test_logs.snapshot.json"] | golang lambda cloudwatchLogs cannot Unmarshal CloudwatchLogsLogEvent as ID is passed as int expects string | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
cannot unmarshal number into Go struct field CloudwatchLogsLogEvent.logEvents.id of type string\"; logsEvent.AWSLogs=\"{Data:H4sIAHLYr2EC/5XRwY6CMBAG4Fchc8akUBYR48FkXU970ttiNiyMbJNCTVswG8O77wAaOXCQ3vp3Ol8nvUGJxqQFHv8uCDG8b4/b78/d4bDd78AFda1QU8xGi2Kpir1W9YVOMqnqPK2tKlMrVLXIsVlYNPZcV9miKqiyQN34XcSHmwerMS3pap+ZYeeCqX9MpsWl6/IhpEVtIP6CZ4tzH3pw6rvsGqxsV3EDkUPMQxesoFlsWtKzvJBHfrRa8ogxz33MSOYteWwSiBP4RSmVc1Va5mtHUPt+CMdLwE0AM4NVQ3VOQmKWyiHtYJFT7LXQund+Oc2vGPPn8/5LvD/io0k+oN/i83n+Es9H/Gqa9xgL5vPBS3zw5AM2zfuMvY35aW8TOoO16RnnTmxCaE/tP806IuEfAwAA}
If you base64 -d|gunzip -|jq . you will see each of the logEvents has a numeric value to the "id" field.
The Aaws PI for all releases expects ID to be string not a number.
See: https://raw.githubusercontent.com/aws/aws-lambda-go/main/events/cloudwatch_logs.go
I developed a replacement for this package and refactored my lambda to call the Parse against an ID of type int64 and my lamba worked fine.
type CloudwatchLogsLogEvent struct {
// ID string `json:"id"`
ID int64 `json:"id"`
Timestamp int64 `json:"timestamp"`
Message string `json:"message"`
}
### Expected Behavior
I expect the func (c CloudwatchLogsRawData) Parse() (d CloudwatchLogsData, err error) to unmarshal ok.
I expect the ID to be a string as required by aws, but it is not; I am unsure if this is a bug in localstack or the aws golang code.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker run --privileged --rm $-d --name localstack -v "/var/run/docker.sock:/var/run/docker.sock" -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG=1 -e LAMBDA_EXECUTOR=docker -e HOSTNAME_EXTERNAL=localstack -p 4566:4566 -p 4571:4571 localstack/localstack:latest
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
alias AWSBASECMD="docker run --rm --network=host -v $(pwd):$(pwd) -w $(pwd) -e AWS_DEFAULT_REGION=us-east-1 -e AWS_ACCESS_KEY_ID=test -e AWS_SECRET_ACCESS_KEY=test amazon/aws-cli:2.2.8 --endpoint-url=http://localhost:4566"
I am not attaching the entire golang lambda impl, but the gist is
```
import "github.com/aws/aws-lambda-go/events"
import "github.com/aws/aws-lambda-go/lambda"
func main() {
lambda.Start(HandleRequest)
}
func HandleRequest(ctx context.Context, logsEvent events.CloudwatchLogsEvent) {
fmt.Fprintf(os.Stderr, "In ngloggerv2 HandleRequest\n")
data, err := logsEvent.AWSLogs.Parse() // data CloudwatchLogsData
if err != nil {
// The aws CloudwatchLogsEvent parsing fails because there is an ID string field in CloudwatchLogsLogEvent but is passed in as an int
fmt.Fprintf(os.Stderr, "Warning: The parsing of the CloudwatchLogsEvent returned error \"%+v\"; logsEvent.AWSLogs=\"%+v\"\n", err, logsEvent.AWSLogs)
err = nil
}
}
```
docker run -v $(pwd):$(pwd) -w $(pwd) -e GOPROXY=direct -e GOOS=linux golang:1.17.1 go build -o ngloggerv2 *.go
docker run -v $(pwd):$(pwd) -w $(pwd) kramos/alpine-zip ngloggerv2.zip ngloggerv2
AWSBASECMD lambda create-function --function-name=ngloggerv2 --runtime=go1.x --role=fakerole --handler=ngloggerv2 --region=us-east-1 --zip-file fileb://ngloggerv2.zip
OSXRMAURMBP16:localstack rmauri$ cat testdata/localstacktest3-input.json
[
{
"timestamp": 1638289738001,
"message": "{\"message\":\"hello world; iteration 1\",\"ecsenv\": \"local\",\"eventid\":1}"
},
{
"timestamp": 1638289739002,
"message": "{\"message\":\"hello world; iteration 2\",\"ecsenv\": \"local\",\"eventid\":2}"
},
{
"timestamp": 1638289740003,
"message": "{\"message\":\"hello world; iteration 3\",\"ecsenv\": \"local\",\"eventid\":3}"
},
{
"timestamp": 1638289741004,
"message": "{\"message\":\"hello world; iteration 4\",\"ecsenv\": \"local\",\"eventid\":4}"
},
{
"timestamp": 1638289742005,
"message": "hello world; iteration=6 ecsenv=local eventid=6"
}
]
Then I execute this shell script which sets up a subscription filter between lambda and cloudwatch logs and then aws logs put-log-events.
The lambda writes to stderr, which goes to cloudwatchlogs and the test script reads the log entries and writes out as follows.
Notice the error about json unmarshaling.
$ ./localstacktest-ngloggerv2.sh test3
The /aws/lambda/ngloggerv2 streams (stdout/err output from ngloggerv2) are:
STREAMS={
"logStreams": [
{
"logStreamName": "2021/12/07/[LATEST]99ecd653",
"creationTime": 1638915982672,
"firstEventTimestamp": 1638915982638,
"lastEventTimestamp": 1638915982680,
"lastIngestionTime": 1638915982692,
"uploadSequenceToken": "1",
"arn": "arn:aws:logs:us-east-1:000000000000:log-group:/aws/lambda/ngloggerv2:log-stream:2021/12/07/[LATEST]99ecd653",
"storedBytes": 8237
}
]
}
{
"events": [
{
"timestamp": 1638915982638,
"message": "\u001b[32mSTART RequestId: f7f3fc97-fd8b-1bb3-7ee6-0036411dede3 Version: $LATEST",
"ingestionTime": 1638915982692
},
{
"timestamp": 1638915982639,
"message": "\u001b[0m",
"ingestionTime": 1638915982692
},
{
"timestamp": 1638915982641,
"message": "In ngloggerv2 HandleRequest",
"ingestionTime": 1638915982692
},
{
"timestamp": 1638915982642,
"message": "Warning: The parsing of the CloudwatchLogsEvent returned error \"json: cannot unmarshal number into Go struct field CloudwatchLogsLogEvent.logEvents.id of type string\"; logsEvent.AWSLogs=\"{Data:**H4sIAI3fr2EC/5XRwY6CMBAG4Fchc4akUETFeCBZ19Oe9LaYDQsj26RQ0xbMxvDuO4BmOXDQ3vp3Ol8nvUGFxmQlHn8vCDG8Jcfk62N3OCT7HbigrjVqitlkUSxVudequdBJLlVTZI1VVWaFqr0CW8+iseemzr26pMoSdRv0ER9vHqzGrKKrQ2bGnQum+Ta5Fpe+y7uQFrWB+BP+W5yH0IfT0GXXYm37ihuIAmLOXbCCZrFZRc/yI74KVuslXzHmu48Zybylj00KcQo/KKVyrkrLYuMIaj8M4fgpuClgbrBuqc5JScwzOaY9LAqK/Q46986H8/yaseB1PniKDyb8YpYP6bf46zx/iucTPprnfcbC1/nwKT6c8Mt5PmBsMeXnvW3kjNZ2YJw7sY2gO3V/P9lT3B8DAAA=**}\"",
"ingestionTime": 1638915982692
},.....
See attached zip file containing the test client.
[localstacktest-ngloggerv2.zip](https://github.com/localstack/localstack/files/7672027/localstacktest-ngloggerv2.zip)
### Environment
```markdown
- OS: macos running localstack docker and client running aws-cli docker image
- LocalStack:
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5091 | https://github.com/localstack/localstack/pull/6202 | c05736fb808860b6327ce400bce7ddf988af4338 | 9147f966abeed46267f132afe81b4bc5144265e0 | 2021-12-07T22:33:33Z | python | 2022-06-07T12:43:45Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,048 | ["MANIFEST.in", "localstack/services/events/events_listener.py", "localstack/services/events/events_starter.py", "localstack/services/providers.py", "localstack/services/route53/route53_starter.py", "requirements.txt", "tests/integration/test_route53.py"] | feature request: Route53Resolver | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
Support for the Route53 Resolver service. Some common resources for the resolver service are the resolver endpoint, resolver rule, and resolver rule association.
### 🧑💻 Implementation
The service exists in the localstack/moto fork so my guess is the edge router just needs to load or connect to that backend.
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/5048 | https://github.com/localstack/localstack/pull/5077 | abcb86574d08b90396c345b8c36cfa0ab323bcea | 5e999100f4618138610a8331d3695c275cf9aff7 | 2021-12-01T14:49:42Z | python | 2021-12-05T20:53:26Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 5,032 | ["Makefile"] | Enhanced Container Image Tagging | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
Please Tag [container images](https://hub.docker.com/r/localstack/localstack/tags) for Major/Minor/Patch version ranges.
As a consumer of the localstack docker image it would be nice to get the latest image within a version range, and not rely on `latest` tag which could contain breaking changes at any time.
One possible example of a tagging scheme:
Current Code Release is: `0.13.0`
Current Image Tag is: `0.13.0.8` (I think)
Example Tag for current for Major Version: `0`
- Would include `0.14.x`
- Would not include `1.x.x`
Example Tag for current Minor Version: `0.13`
- Would include `0.13.1`
- Would not include `0.14.x`
- Would not include `1.x.x`
Example Tag for the current Patch Version: `0.13.0`
- Would include `0.13.0.x`
- Would not include `0.13.1`
- Would not include `0.14.x`
- Would not include `1.x.x`
An example of a docker image that does this is the [postgres image](https://hub.docker.com/_/postgres/)
### 🧑💻 Implementation
While I believe it would be easy enough to update the make file to do this whenever a release is cut, but I don't know how docker hub tags `0.13.0.8` when the latest release is `0.13.0`.
### Anything else?
I don't think the current usage of the `latest` tag would need to change, but it should be known that I don't know if `latest` means latest build in any branch (ie, security patch for 0.12.x) or latest build from the latest release only.
Love the library. Very happy to see that version 0.13.0 introduces lazy loading. This cut down start time by 66% for me! | https://github.com/localstack/localstack/issues/5032 | https://github.com/localstack/localstack/pull/5071 | a943e21bc61d3805c1c89ddf832c31c13607ba18 | 88155fd7b47a2640cb1c0207c84c3b56a659b023 | 2021-11-29T23:28:30Z | python | 2021-12-06T19:06:40Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,891 | ["localstack/services/apigateway/helpers.py", "tests/integration/test_api_gateway.py"] | bug: API Gateway base-path-mappings don't work for the (none) path | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When creating base-path-mappings on an API Gateway, there is a special `(none)` path when you don't specify a path during creation. Localstack stores this as `basePath: "(none)"` internally.
When you query to get the base paths, the URLs are escaped by the client (verified in both awscli and terraform) so the basePath is sent as `%28none%29` in the url.
Localstack doesn't appear to be decoding urls and when you attempt to get-base-path-mapping it fails in a string comparison of `(none)` to `%28none%29`.
```shell
> aws --endpoint-url=http://localhost:4566 apigateway get-base-path-mapping --domain-name example.com --base-path "(none)"
An error occurred (NotFoundException) when calling the GetBasePathMapping operation: Base path mapping not found: %28none%29
```
### Expected Behavior
When you attempt to get-base-path-mappings after creating one with the (none) path, it succeeds and returns the mapping.
```
> aws --endpoint-url=http://localhost:4566 apigateway get-base-path-mapping --domain-name example.com --base-path "(none)"
{
"basePath": "(none)",
"restApiId": "uyy4c3dsho",
"stage": "dev"
}
```
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
make start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal apigateway create-rest-api --name "testgw"
awslocal apigateway create-base-path-mapping --domain-name example.com --rest-api-id <from output above> --stage dev
awslocal apigateway get-base-path-mapping --domain-name example.com --base-path "(none)"
### Environment
```markdown
- OS: fedora 34
- LocalStack: latest
```
### Anything else?
https://docs.aws.amazon.com/apigateway/api-reference/link-relation/basepathmapping-by-base-path/ | https://github.com/localstack/localstack/issues/4891 | https://github.com/localstack/localstack/pull/4901 | 8a50b5b23f0b025eaef6fc9e88ea9e863cb4f956 | 10b34b0918a6d9237b27cb6e04f70e38e14c3096 | 2021-11-10T00:11:32Z | python | 2021-11-11T10:38:22Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,876 | ["localstack/config.py"] | bug: Lambda improperly parses docker images with digest | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Using the serverless framework, when deploying a lambda function that uses a custom container runtime, the image is pushed to localstack with an "ImageUri" value that includes the docker image's digest (e.g. `localhost:4513/serverless-test-local@sha256:306d92[TRUNCATED]`). When executing that lambda function, fullstack uses the docker url that includes the digest, and improperly treats the portion after `:` as an image tag (https://github.com/localstack/localstack/blob/master/localstack/utils/docker_utils.py#L1203), causing the function to fail.
### Expected Behavior
Localstack should pull the docker image with the properly formatted digest and successfully execute the lambda function.
### How are you starting LocalStack?
With the `localstack` script
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
localstack start
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
Sample serverless.yml
```
service: test
plugins:
- serverless-localstack
frameworkVersion: '2'
provider:
name: aws
lambdaHashingVersion: 20201221
ecr:
images:
test:
path: ./test
custom:
localstack:
debug: true
stages:
- local
host: http://localhost
edgePort: 4566
autostart: true
docker:
sudo: False
functions:
test:
image:
name: test
```
Execute function
```
sls deploy --stage local
awslocal lambda invoke --function-name test-local-test /dev/null
```
Localstack error
```
2021-11-08T19:25:08:INFO:localstack.services.awslambda.lambda_executors: Running lambda: arn:aws:lambda:us-east-1:000000000000:function:test-local-test
2021-11-08T19:25:08:DEBUG:localstack_ext.services.awslambda.lambda_extended: Putting invocation event (request ID d01c1e28) for Lambda 'arn:aws:lambda:us-east-1:000000000000:function:test-local-test' to queue
2021-11-08T19:25:08:DEBUG:localstack_ext.services.awslambda.lambda_launcher: Executing custom image execution for image localhost:4513/serverless-test-local@sha256:306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221
2021-11-08T19:25:11:DEBUG:localstack.utils.docker_utils: Pulling image: localhost:4513/serverless-test-local@sha256:306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221
2021-11-08T19:25:11:DEBUG:localstack.utils.docker_utils: Repository: localhost:4513/serverless-test-local@sha256 Tag: 306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221
2021-11-08T19:25:12:ERROR:localstack_ext.services.awslambda.lambda_extended: Unable to invoke Lambda "arn:aws:lambda:us-east-1:000000000000:function:test-local-test":
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/api/client.py", line 268, in _raise_for_status
response.raise_for_status()
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.41/images/create?tag=306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221&fromImage=localhost%3A4513%2Fserverless-test-local
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1208, in pull_image
self.client().images.pull(repository, tag)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/models/images.py", line 447, in pull
repository, tag=tag, stream=True, all_tags=all_tags, **kwargs
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/api/image.py", line 430, in pull
self._raise_for_status(response)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/api/client.py", line 270, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.41/images/create?tag=306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221&fromImage=localhost%3A4513%2Fserverless-test-local: Not Found ("manifest for localhost:4513/serverless-test-local:306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221 not found: manifest unknown: manifest unknown")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_extended.py", line 448, in do_run_lambda_executor
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_launcher.py", line 222, in docker_separate_execute_in_container
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_launcher.py", line 189, in custom_image_execute_in_container
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_launcher.py", line 148, in get_image_entrypoint_cmd
File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1212, in pull_image
raise ContainerException()
localstack.utils.docker_utils.ContainerException
2021-11-08T19:25:12:INFO:localstack_ext.services.awslambda.lambda_extended: Lambda container output: None
None
2021-11-08T19:25:12:INFO:localstack.services.awslambda.lambda_api: Error executing Lambda function arn:aws:lambda:us-east-1:000000000000:function:test-local-test: Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/api/client.py", line 268, in _raise_for_status
response.raise_for_status()
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.41/images/create?tag=306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221&fromImage=localhost%3A4513%2Fserverless-test-local
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1208, in pull_image
self.client().images.pull(repository, tag)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/models/images.py", line 447, in pull
repository, tag=tag, stream=True, all_tags=all_tags, **kwargs
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/api/image.py", line 430, in pull
self._raise_for_status(response)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/api/client.py", line 270, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.41/images/create?tag=306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221&fromImage=localhost%3A4513%2Fserverless-test-local: Not Found ("manifest for localhost:4513/serverless-test-local:306d925cd4f0188bcb9808c7715fc444dff3eee356415e58651db25304825221 not found: manifest unknown: manifest unknown")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 813, in run_lambda
lock_discriminator=lock_discriminator,
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 429, in execute
return do_execute()
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 419, in do_execute
return _run(func_arn=func_arn)
File "/opt/code/localstack/localstack/utils/cloudwatch/cloudwatch_util.py", line 158, in wrapped
raise e
File "/opt/code/localstack/localstack/utils/cloudwatch/cloudwatch_util.py", line 154, in wrapped
result = func(*args, **kwargs)
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 406, in _run
raise e
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 402, in _run
result = self._execute(lambda_function, inv_context)
File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 710, in _execute
result = self.run_lambda_executor(lambda_function=lambda_function, inv_context=inv_context)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_extended.py", line 538, in run_lambda_executor
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_extended.py", line 436, in run_lambda_executor
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_extended.py", line 448, in do_run_lambda_executor
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_launcher.py", line 222, in docker_separate_execute_in_container
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_launcher.py", line 189, in custom_image_execute_in_container
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/localstack_ext/services/awslambda/lambda_launcher.py", line 148, in get_image_entrypoint_cmd
File "/opt/code/localstack/localstack/utils/docker_utils.py", line 1212, in pull_image
raise ContainerException()
localstack.utils.docker_utils.ContainerException
```
### Environment
```markdown
- OS: MacOS Big Sur 11.1
- LocalStack: 0.12.20
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4876 | https://github.com/localstack/localstack/pull/4882 | cfdca7ba0bfc26a0a802d6969625686fe64006f0 | 8efad3f187a4ba6dae022d2d1ca0d2f6964e9a3a | 2021-11-08T19:42:46Z | python | 2021-11-09T20:25:12Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,794 | ["localstack/services/dynamodb/dynamodb_listener.py", "tests/integration/test_dynamodb.py"] | bug: dynamodb to kinesis stream has `null` `OldImage` when deleting an item | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Here are the kinesis events from inserting/deleting a dynamodb item:
```
{"eventID":"cf1199b0","eventVersion":"1.1","dynamodb":{"ApproximateCreationDateTime":1.635284406858227E9,"SizeBytes":56,"Keys":{"hash":{"S":"hash-691"},"range":{"S":"range-153"}},"NewImage":{"hash":{"S":"hash-691"},"range":{"S":"range-153"}}},"awsRegion":"us-east-1","eventSource":"aws:dynamodb","eventName":"INSERT","tableName":"bug"}
{"eventID":"976b515b","eventVersion":"1.1","dynamodb":{"ApproximateCreationDateTime":1.6352844070969691E9,"SizeBytes":4,"Keys":{"hash":{"S":"hash-691"},"range":{"S":"range-153"}},"OldImage":null},"awsRegion":"us-east-1","eventSource":"aws:dynamodb","eventName":"REMOVE","tableName":"bug"}
```
Note that the remove event has `OldImage` = `null`
### Expected Behavior
I expected `OldImage` to be `{"hash":{"S":"hash-691"},"range":{"S":"range-153"}}`.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
https://github.com/achaphiv/issue-localstack-dynamodb-stream-to-kinesis
```
# Create table/stream and hook them up
docker-compose up -d
# Create/delete an item
./mvnw -P write-to-dynamodb
# See the produced records
./mvnw -P watch-kinesis
```
### Environment
```markdown
- OS: Manjaro Linux
- LocalStack: 0.12.19
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4794 | https://github.com/localstack/localstack/pull/4924 | 4a3d80725ddd68faff3996756dd43092fba94848 | a8ce5ec07024447b6482cdceab48e365324c0992 | 2021-10-26T21:49:04Z | python | 2021-11-20T19:23:42Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,786 | [".circleci/config.yml", "localstack/services/cloudformation/models/awslambda.py", "tests/integration/cloudformation/test_cloudformation_lambda.py", "tests/integration/docker_utils/__init__.py", "tests/integration/docker_utils/conftest.py", "tests/integration/docker_utils/test_docker.py", "tests/integration/templates/lambda_inline_code.yaml"] | bug: Redeploying lambda with CDK fails "localstack.services.awslambda.lambda_api.ClientError: Uploaded Lambda code for runtime (nodejs14.x) is not in Zip format" | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When using CDK to deploy a simple Lambda function the stack deploys first time and is successful.
Though when deployed a second time it fails.
If I change the name of the lambda it will be successfully.
### Expected Behavior
To redeploy and update the lambda successfully
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
`docker-compose up`
Compose file:
```yaml
version: '3.8'
services:
localstack:
container_name: '${LOCALSTACK_DOCKER_NAME-localstack_main}'
image: localstack/localstack
network_mode: bridge
ports:
- '127.0.0.1:53:53' # only required for Pro
- '127.0.0.1:53:53/udp' # only required for Pro
- '127.0.0.1:443:443' # only required for Pro
- '127.0.0.1:4510-4530:4510-4530' # only required for Pro
- '127.0.0.1:4566:4566'
- '127.0.0.1:4571:4571'
environment:
- SERVICES=${SERVICES- }
- DEBUG=${DEBUG- }
- DATA_DIR=${DATA_DIR- }
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
- LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY- } # only required for Pro
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- '${TMPDIR:-/tmp}/localstack:/tmp/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'
```
Stack file:
```ts
import * as cdk from '@aws-cdk/core';
import * as lambda from '@aws-cdk/aws-lambda';
import { Construct } from '@aws-cdk/core';
import { Environment } from '../environment/environment';
function getStackName(environment: Environment): string {
if (environment === 'local') {
return 'local';
}
return `project-${environment}`;
}
export class TestServiceStack extends cdk.Stack {
constructor(scope: cdk.App, environment: Environment, props?: cdk.StackProps) {
super(scope, getStackName(environment), props);
const lambda = this.createS3PackageReceived(this);
}
private createS3PackageReceived(owner: Construct): lambda.Function {
const handler = new lambda.Function(owner, 'fn', {
code: lambda.Code.fromInline(`exports.handler = async (event, context) => {return "hello"}`),
handler: 'index.handler',
functionName: 'test-func3',
runtime: lambda.Runtime.NODEJS_14_X,
});
return handler;
}
}
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
Deployments are done with:
```bash
docker-compose up
npx cdklocal bootstrap -v
npx cdklocal deploy --progress events --require-approval never # will be successful
npx cdklocal deploy --progress events --require-approval never # will fail
```
In the logs there are two interesting things:
1. `2021-10-25T22:35:51:WARNING:localstack.utils.cloudformation.template_deployer: Unable to deploy resource type "CDK::Metadata": {'Type': 'AWS::CDK::Metadata', 'Metadata': {'aws:cdk:path': 'local/CDKMetadata/Default'}, 'Condition': 'CDKMetadataAvailable', 'LogicalResourceId': 'CDKMetadata', 'Properties': {'Analytics': 'v2:deflate64:H4sIAAAAAAAAE02MSQoCMRBFz9L7dLXlgLgTGjxAPEFMIlQPVZBBFyF31yiCq/fgDwgFcQeb7myesbduHqwED+WajJ3VKBxTyDap8c7aR8nB+ubvwFEi4apwe/qfN5bFrDdnoFwy29Zqk59XRWaFomX5PDXWWhWL8zDF4YF7wCMcuikS9SFzotWD/vIFs9XuYq4AAAA='}}`
This warning is generated for both successful and unsuccessful deployments
2.
```
2021-10-25T22:36:50:ERROR:lambda_api: Exception on /2015-03-31/functions/test-func/code [PUT]
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1482, in update_function_code
result = set_function_code(lambda_function)
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1013, in set_function_code
run_for_max_seconds(config.LAMBDA_CODE_EXTRACT_TIME, _set_and_configure)
File "/opt/code/localstack/localstack/utils/common.py", line 1747, in run_for_max_seconds
raise result
File "/opt/code/localstack/localstack/utils/common.py", line 1728, in _worker
fn_result = _function(*args, **kwargs)
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1006, in _set_and_configure
lambda_handler = do_set_function_code(lambda_function)
File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1081, in do_set_function_code
"Uploaded Lambda code for runtime ({}) is not in Zip format".format(runtime)
localstack.services.awslambda.lambda_api.ClientError: Uploaded Lambda code for runtime (nodejs14.x) is not in Zip format
```
this is generated on the second deployment. This stack trace is generated multiple times.
### Environment
```markdown
- OS: OSX 11.6
- LocalStack:
- localstack_main | LocalStack version: 0.12.19.1
- localstack_main | LocalStack Docker container id: deb3b6cc94e5
- localstack_main | LocalStack build date: 2021-10-25
- localstack_main | LocalStack build git hash: 109e0173
- package.json dependencies
{
"devDependencies": {
"@aws-cdk/assert": "1.113.0",
"@types/express": "^4.17.13",
"@types/jest": "^26.0.23",
"@types/supertest": "^2.0.11",
"aws-cdk": "^1.129.0",
"aws-cdk-local": "^1.65.8",
"jest": "^26.6.3",
"nodemon": "^2.0.10",
"supertest": "^6.1.3",
"ts-jest": "^26.5.5",
"ts-node": "^10.0.0",
"typescript": "^4.3.3"
},
"dependencies": {
"@aws-cdk/aws-lambda": "^1.113.0",
"@aws-cdk/aws-lambda-event-sources": "^1.129.0",
"@aws-cdk/aws-s3": "^1.113.0",
"@aws-cdk/core": "1.113.0",
"@squiz-dx/asset-api": "^1.0.0",
"express": "^4.17.1"
}
}
```
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4786 | https://github.com/localstack/localstack/pull/4802 | ce3e2838863276dd3cf98cb4a8d3aabf89abd7c1 | 14202f8a613458ac5f8e6dec4d0218dd7e789ac4 | 2021-10-25T22:40:37Z | python | 2021-10-30T18:12:01Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,771 | ["localstack/config.py", "localstack/utils/analytics/client.py", "localstack/utils/common.py", "tests/unit/test_common.py"] | question: Use HTTP proxy when downloading resources | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
I'm running Localstack inside minikube on macOS. Due to the networking configuration in macOS, I need to use an HTTP proxy whenever I'm connected to a VPN.
This means that Localstack fails to start inside minikube when the host is connected to a VPN. The issue came up when Localstack tried to download https://github.com/localstack/localstack-artifacts/raw/master/local-certs/server.key.
Is there a way to tell Localstack to use an HTTP proxy when downloading resources?
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4771 | https://github.com/localstack/localstack/pull/4797 | a201ff49852c27b35fc326a160a55ef873fd382c | c83f3360b004a6587cd54880459a20c97f6b7903 | 2021-10-21T20:23:48Z | python | 2021-10-28T11:21:23Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,769 | ["bin/docker-entrypoint.sh", "localstack/services/edge.py", "localstack/services/infra.py", "localstack/services/plugins.py", "tests/unit/test_edge.py"] | question: No longer possible to wait for initScripts:initialized? | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
A [recent commit](https://github.com/localstack/localstack/commit/f41b25cc8d68e97ce8eacd4374ded4a8072e50f6#diff-368e25a43c4a3200ecb9ae21e7b2a94da05d8eb24680bd6c2a37ee0e275bcd0aL67) scrapped the `{"features:initScripts":"initialized"}` feature that my team was relying on to bootstrap our development environment.
Basically we are putting a provisioning script in `/docker-entrypoint-initaws.d/` that installs Terraform and runs our Terraform definitions against `http://localhost:4566`. Then, the service that needs the AWS infrastructure has an entrypoint that polls `http://localstack:4566/health` and keeps looking for `{"features:initScripts":"initialized"}` in the response before attempting to actually start the service.
We found by trial and error that this was the most reliable way to bring up our stack, as opposed to looking for specific services to appear in the `/health` payload. However, now with this change we can't detect exactly when our Terraform provisioning finishes. It'd be great to get back that feature, or to have another way to detect when the LocalStack entrypoint has finished running the scripts in `/docker-entrypoint-initaws.d/`. For now we'll be sticking to `:0.12.19` instead of `:latest` as suggested.
Thank you.
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4769 | https://github.com/localstack/localstack/pull/4770 | 1a998e45038abaf6e39f3d0b05ce50c5a554e5c0 | c75328db9c09ff5524037404ca8adb43f818e323 | 2021-10-21T12:09:00Z | python | 2021-10-21T16:29:58Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,753 | ["localstack/constants.py"] | feature request: Update Elastic Search to 7.10 for supporting case insensitive term queries | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Feature description
As a DEVELOPER for a Bayer project we need LocalStack with Elastic Search version 7.10.
In version 7.10 `case_insensitive` option were be added. [Term Query Doc](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/query-dsl-term-query.html)
## Remarks
- 7.10 is the latest version under free Apache 2.0 license.
- Switching to [Opensearch](https://github.com/opensearch-project/OpenSearch) would be also possible.
### 🧑💻 Implementation
_No response_
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4753 | https://github.com/localstack/localstack/pull/4755 | e7826b4167745b0a74f4d6041fdbe031e075835f | d5690645d5945c08071e63b4450b9035a11df498 | 2021-10-19T06:24:38Z | python | 2021-10-19T21:23:25Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,743 | ["localstack/services/s3/s3_listener.py"] | bug: extra chunk-signature data in s3 | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Note: I create this bug as I didn't get an answer in another related [issue](https://github.com/localstack/localstack/issues/98#issuecomment-929993979) (#98).
After restarting localstorage, when I do a S3 getObject of a file, it gives me the file with some extra chunk-signature data. Example:
```json
1e5;chunk-signature=83a45ce7e9db52171538036b946102068a9f2005c53049b23c63515f1c048fbc
{ "test": "this is a test json" }
0;chunk-signature=bd812928970799e2d5d16a86900629155d7d38aba42ed2dcbc7d6559c364671f
```
### Expected Behavior
The behaviour expected is getting the object without the extra chunk-signature data as it breaks parsing the file after.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
In order to easily reproduce this bug, I've created a [repository](https://github.com/herrlegno/localstack-s3-signature-error).
# Steps:
* Create a s3 bucket named: test
* Run 1º test (the one with (Order(1) decorator)
* After the test has successfully passed, restart the localstack container.
* Run only the "extendsS3Object" (Order(2) decorator) test or download the file "test.json" from s3 through awscli.
The file will look like something like this:
```json
19;chunk-signature=f64cba77c6523187a1448fd7bd9cd739ce9d953c951af6fe34ac787b8b8f60d6
{"foo":"bar"}
0;chunk-signature=fcc672670aab469d7e23cd6eeea9cb5639feca2f065510bcfb77f057bb391c9b
```
### Environment
```markdown
- OS: Pengwin WSL (but also tried in a native ubuntu 20.10)
- LocalStack: latest
- AWS Java S3 Client: 1.11.73
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4743 | https://github.com/localstack/localstack/pull/4939 | 10ce50ce2abe65973ed2d97233df5e1a717d26f1 | 3ca09d8df3f1858f29c239c88baf69c9565b2091 | 2021-10-18T10:30:58Z | python | 2021-11-17T17:28:57Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,736 | ["localstack/config.py"] | question: ENABLE_CONFIG_UPDATES for docker image | ### Is there an existing issue for this?
- [x] I have searched the existing issues and read the documentation
### Question
Seems like ENABLE_CONFIG_UPDATES=1 works only in host mode.
Is there way to enable it for docker ?
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4736 | https://github.com/localstack/localstack/pull/4741 | 457506b03601ba42efee78029f0230ca6ad7a707 | 4e5e3845433552c245b734af7a8ba4679826ee34 | 2021-10-15T08:05:45Z | python | 2021-10-18T09:59:55Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,719 | ["localstack/services/apigateway/apigateway_listener.py", "localstack/utils/common.py", "tests/unit/test_apigateway.py"] | Does LocalStack support HTTP Integrations in ApiGateway (Websockets)? | ### Is there an existing issue for this?
- [X] I have searched the existing issues and read the documentation
### Question
Using a websocket apigatewayv2 in localstack and i need to change the body of the request e.g. add the connectionid, which is something i can do with a HTTP integration on the AWS gateway, however when I try this with localstack i receive the following error "Unsupported integration type "HTTP" for Websocket API ID" and then prints the ID of the API, if this feature is not enabled then how should we test the actual API where the connectionId and other things are added to the request body
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4719 | https://github.com/localstack/localstack/pull/5381 | b53574d11359dcf05fe7f48c69e0b85fffe276e0 | e9bfab3b3deb192a3f73359cd5ca0a6f15d96184 | 2021-10-11T16:52:24Z | python | 2022-01-28T12:09:45Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,656 | ["localstack/services/sqs/sqs_listener.py"] | Version 0.12.18 breaks elasticmq functionality | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Starting the localstack docker using the elasticmq SQS backend results in not being able to send any messages. Appears to work fine in 0.12.17
### Expected Behavior
Messages should send fine.
### How are you starting LocalStack?
With a `docker run` command
### Steps To Reproduce
Run docker with:
```
docker run --rm -it -p 4566:4566 --env SERVICES=sqs --env SQS_PROVIDER=elasticmq --env DEBUG=1 localstack/localstack:0.12.18
```
Execute a simple SQS send:
```
AWS_ACCESS_KEY_ID=x AWS_SECRET_ACCESS_KEY=y aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name foo && aws --endpoint-url=http://localhost:4566 sqs send-message --queue-url "http://localhost:4658/000000000000/foo" --message-body foo
```
results in failure:
```
Unable to parse response (not well-formed (invalid token): line 1, column 0), invalid XML received. Further retries may succeed:
b'{}'
```
### Environment
```markdown
- OS: macOS 11.6
- LocalStack: 0.12.18
```
### Anything else?
I'm pretty sure that commit e38778888534cb6d98f27edaf5af76c1e1d29e06 broke the functionality. I _think_ the `_process_sent_message` function is assuming something about the response that just isn't true, but I haven't gotten any further in my analysis.
Also, I need to use elasticmq because the moto implementation is just not fast enough. We've been using an older release (0.11.3), using elasticmq, and I can send and receive 10,000 2K bodies in about 25 seconds, but using 0.12.18 and moto I can only send about 1200 and receive about 450 in those 25 seconds, and the slowdown just isn't acceptable for our integration tests. | https://github.com/localstack/localstack/issues/4656 | https://github.com/localstack/localstack/pull/4657 | a01690e38935933bdd3cc7ef46d2ac69d8e8bc7c | 97a691d532dfb2f71491c0853055455dd19ef308 | 2021-09-28T18:12:10Z | python | 2021-09-29T09:14:51Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,651 | ["localstack/services/awslambda/lambda_api.py", "localstack/services/awslambda/lambda_executors.py", "tests/integration/test_stepfunctions.py"] | custom error return to catch from step functions | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
A lambda from my step function can return an error (if a condition is not satisfied) but in a local environment the return error does not fall in my custom catch, falling only in States.ALL.
```json
"Catch": [
{
"ErrorEquals": [
"TooManyRequestsException"
],
"Next": "Wait and Try Later"
},
{
"ErrorEquals": [
"States.ALL"
],
"Next": "Catch All"
}
]
},
"Wait and Try Later": {
"Type": "Wait",
"Seconds": 10,
"Next": "Catch lambda"
},
"Catch All": {
"Type": "Fail",
"Cause": "Unknown error!",
"Error": "Caiu no erro geral"
}
```
I'm generating the error customizing like this
```javascript
module.exports.handler = async function context(
event,
context,
options
) {
class CustomError extends Error {
constructor(message){
super(message);
this.name = "TooManyRequestsException"
}
}
const err = new CustomError('new error')
throw err;
}
```
### Expected Behavior
I did the same procedure in the aws console and it worked perfectly falling into the custom error, only in the development environment that I couldn't and I came for help.
Does anyone know if it can be some configuration?
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
```yaml
version: '3.8'
services:
localstack:
image: localstack/localstack
environment:
- DEBUG=true
- SERVICES=lambda,stepfunctions,iam,apigateway,s3,ses
- DATA_DIR=/tmp/localstack/data
- TZ=America/Fortaleza
- LAMBDA_DOCKER_NETWORK=payment-api
- LAMBDA_EXECUTOR=docker
ports:
- 4566:4566
volumes:
- /tmp/localstack:/tmp/localstack
- /var/run/docker.sock:/var/run/docker.sock
- .:/server
depends_on:
- mongo
```
### Environment
_No response_
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4651 | https://github.com/localstack/localstack/pull/5626 | 6d9b57f197abe2d13d4520a763e6760922e7f1ab | 6f4bcb61081acaa478e3fb372a46a45afb9546f1 | 2021-09-27T18:27:15Z | python | 2022-03-09T10:00:58Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,611 | ["localstack/services/cloudformation/models/events.py", "localstack/services/events/events_starter.py", "localstack/utils/aws/message_forwarding.py", "localstack/utils/common.py", "localstack/utils/generic/wait_utils.py", "tests/integration/cloudformation/test_cloudformation_events.py", "tests/integration/templates/events_loggroup.yaml"] | bug: not possible to use CloudWatch as EventBridge target | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
When trying to use CloudWatch as a target for an EventBridge eventbus I receive a warning `WARNING:localstack.utils.aws.aws_stack: Unsupported Events rule target ARN: "arn:aws:logs:us-east-1:000000000000:log-group:/aws/events/log-imports"` and nothing happens.
### Expected Behavior
I expected to be able to use CloudWatch loggroup as an EventBrigde eventbus target, like I can using AWS.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
`docker-compose.yaml`
#### Additional files
JSON file needed for the `put-events` call
```
[
{
"Source": "com.mycompany.myapp",
"Detail": "{ \"key1\": \"value1\", \"key2\": \"value2\" }",
"Resources": [
"resource1",
"resource2"
],
"DetailType": "myDetailType",
"EventBusName": "messages-eb"
}
]
```
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
awslocal logs create-log-group --log-group-name /aws/events/log-imports
awslocal events create-event-bus --name messages-eb
awslocal events put-rule --name forward-message --event-bus-name messages-eb --event-pattern "{""account"": [""000000000000""]}"
awslocal events put-targets --rule forward-message --event-bus-name messages-eb --targets "Id"="1","Arn"="arn:aws:logs:us-east-1:000000000000:log-group:/aws/events/log-imports"
awslocal events put-events --entries file://events.json
### Environment
```markdown
- OS: Windows 10
- LocalStack: 0.12.17
- Docker Desktop (with WSL2)
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4611 | https://github.com/localstack/localstack/pull/4730 | 0255684203ba00e59c84eb16fea207a37eca382a | f720fe42e727c2c290d7babea3363bf7f8a357f8 | 2021-09-17T08:55:54Z | python | 2021-10-18T23:53:25Z |
closed | localstack/localstack | https://github.com/localstack/localstack | 4,607 | ["localstack/services/ssm/ssm_listener.py", "tests/integration/fixtures.py", "tests/integration/test_ssm.py"] | SSM - labeling more than 10 parameters does not work right | ### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Adding and labeling more than 10 parameters only labels (or only returns) the first 10 labeled parameters.
### Expected Behavior
Adding and labeling more than 10 parameters should add & then return all the parameters.
### How are you starting LocalStack?
With a docker-compose file
### Steps To Reproduce
#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
docker-compose.yml
#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
```
params = [ ... ] # create a list of **more** than 10 parameters ( Name + Value)
for param of params:
# add the parameter (returns 200)
res = ssm.put_parameter(Name=param["Name"], Value=param["Value], Type='String')
# label the returned version with 'latest' (returns 200)
label_res = ssm.label_parameter_version(Name=path, ParameterVersion=res['Version'], Labels=['latest'])
# get the added parameter (returns the parameter successfully)
prm = ssm.get_parameter(Name=path)
# get all parameters with the 'latest' label - this returns the first 10 parameters (although `MaxResults` is 100), and also doesn't return a `NextToken` property to iterate through the next batch of parameters.
ps = ssm.get_parameters_by_path(Path=base_path,
ParameterFilters=[ { 'Key': 'Label', 'Values': [ 'latest' ] } ],
MaxResults=100)
```
### Environment
```markdown
- OS: Windows 10
- LocalStack: 0.12.17.5
```
### Anything else?
_No response_ | https://github.com/localstack/localstack/issues/4607 | https://github.com/localstack/localstack/pull/4875 | 0087f9abbf7875818738c8ea7f6b92f8dff82093 | ab8d5597d7e7b4caee393b3cbc7ad62f9877763a | 2021-09-16T14:20:55Z | python | 2021-11-11T12:53:55Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.