Skip to content

Conversation

@kakakakakku
Copy link
Contributor

Issue #, if available:
N/A

Description of changes:
Hi😀 Thanks for the useful patterns!

While testing apigw-lambda-rekognition, I noticed that the Error: Unsupported argument error occurred. Because aws_api_gateway_deployment does NOT have stage_name argument in latest Terraform AWS Provider. We should use aws_api_gateway_stage.

╷
│ Error: Unsupported argument
│ 
│   on main.tf line 148, in resource "aws_api_gateway_deployment" "deployment":
│  148:   stage_name  = "dev"
│ 
│ An argument named "stage_name" is not expected here.
╵

Check

$ curl --location 'https://6rylrmtfw6.execute-api.ap-northeast-1.amazonaws.com/dev/generate-presigned-url' --header 'Content-Type: text/plain' --data '{"object_name": "image.png", "content_type": "image/png"}'
{"presigned_url": "https://s3.ap-northeast-1.amazonaws.com/xxxxxxxxxxx&Expires=1766540977"}%

$ curl -v --location --request PUT 'https://s3.ap-northeast-1.amazonaws.com/xxxxxxxxxxx&Expires=1766540977' --header 'Content-Type: image/png' --data 'image.png'
* Host s3.ap-northeast-1.amazonaws.com:443 was resolved.
(snip)
< HTTP/1.1 200 OK
(snip)

And more the generate-presigned-url Lambda function call Amazon Rekognition correctly.

image

Thank you😀


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

events = ["s3:ObjectCreated:*"]
}

depends_on = [aws_lambda_permission.allow_s3]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

╷
│ Error: creating S3 Bucket (xxxxx-s3-upload) Notification: operation error S3: PutBucketNotificationConfiguration, https response error StatusCode: 400, RequestID: ZRGV6RJWYEZQXGDX, HostID: hB9Ze5FjoPl01sqeI3/PGRae4EM5YzhB/dKN1oI5V8kUP5c2t1zvsWwsGhHU8D94FtmL2uETUi8=, api error InvalidArgument: Unable to validate the following destination configurations
│ 
│   with aws_s3_bucket_notification.s3_bucket_notification,
│   on main.tf line 101, in resource "aws_s3_bucket_notification" "s3_bucket_notification":
│  101: resource "aws_s3_bucket_notification" "s3_bucket_notification" {
│ 
╵

curl -v --location --request PUT '<presigned-url>' --header 'Content-Type: image/png' --data '<path-of-the-object>.png'
```
curl -v --location --request PUT '<presigned-url>' --header 'Content-Type: image/png' --data-binary @image.png
```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: --data '<path-of-the-object>.png' command upload not image file. We should use --data-binary option. I updated it and works good😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants