Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQS ReceiveMessageInput.MessageSystemAttributeName missing on version 1.20 ^ #2444

Closed
hryer opened this issue Jan 8, 2024 · 5 comments
Closed
Assignees
Labels
bug This issue is a bug. duplicate This issue is a duplicate. p2 This is a standard priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@hryer
Copy link

hryer commented Jan 8, 2024

Describe the bug

AWS suggests or encourages moving from AttributeNames into MessageSystemAttributeNames when receive message turns out after I updated the aws-sdk-go-v2/service/sqs version from 1.18.4 to < 1.20.8 paramater MessageSystemAttributeNames missing from the sdk

Important
This parameter has been deprecated but will be supported for backward compatibility. To provide attribute names, you are encouraged to use MessageSystemAttributeNames.

AWS SDK DOCS: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html

Expected Behavior

aws/aws-sdk-go-v2/service/[email protected]/api_op_ReceiveMessage.go

type ReceiveMessageInput struct {

	// The URL of the Amazon SQS queue from which messages are received. Queue URLs and
	// names are case-sensitive.
	//
	// This member is required.
	QueueUrl *string

	// A list of attributes that need to be returned along with each message. These
	// attributes include:
	//
	// * All – Returns all values.
	//
	// *
	// ApproximateFirstReceiveTimestamp – Returns the time the message was first
	// received from the queue (epoch time (http://en.wikipedia.org/wiki/Unix_time) in
	// milliseconds).
	//
	// * ApproximateReceiveCount – Returns the number of times a
	// message has been received across all queues but not deleted.
	//
	// * AWSTraceHeader –
	// Returns the X-Ray trace header string.
	//
	// * SenderId
	//
	// * For an IAM user, returns
	// the IAM user ID, for example ABCDEFGHI1JKLMNOPQ23R.
	//
	// * For an IAM role, returns
	// the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456.
	//
	// * SentTimestamp
	// – Returns the time the message was sent to the queue (epoch time
	// (http://en.wikipedia.org/wiki/Unix_time) in milliseconds).
	//
	// *
	// SqsManagedSseEnabled – Enables server-side queue encryption using SQS owned
	// encryption keys. Only one server-side encryption option is supported per queue
	// (e.g. SSE-KMS
	// (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html)
	// or SSE-SQS
	// (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html)).
	//
	// *
	// MessageDeduplicationId – Returns the value provided by the producer that calls
	// the SendMessage action.
	//
	// * MessageGroupId – Returns the value provided by the
	// producer that calls the SendMessage action. Messages with the same
	// MessageGroupId are returned in sequence.
	//
	// * SequenceNumber – Returns the value
	// provided by Amazon SQS.
	AttributeNames []types.QueueAttributeName

	// The maximum number of messages to return. Amazon SQS never returns more messages
	// than this value (however, fewer messages might be returned). Valid values: 1 to
	// 10. Default: 1.
	MaxNumberOfMessages int32

	// The name of the message attribute, where N is the index.
	//
	// * The name can contain
	// alphanumeric characters and the underscore (_), hyphen (-), and period (.).
	//
	// *
	// The name is case-sensitive and must be unique among all attribute names for the
	// message.
	//
	// * The name must not start with AWS-reserved prefixes such as AWS. or
	// Amazon. (or any casing variants).
	//
	// * The name must not start or end with a
	// period (.), and it should not have periods in succession (..).
	//
	// * The name can
	// be up to 256 characters long.
	//
	// When using ReceiveMessage, you can send a list of
	// attribute names to receive, or you can return all of the attributes by
	// specifying All or . in your request. You can also use all message attributes
	// starting with a prefix, for example bar..
	MessageAttributeNames []string

	// This parameter applies only to FIFO (first-in-first-out) queues. The token used
	// for deduplication of ReceiveMessage calls. If a networking issue occurs after a
	// ReceiveMessage action, and instead of a response you receive a generic error, it
	// is possible to retry the same action with an identical ReceiveRequestAttemptId
	// to retrieve the same set of messages, even if their visibility timeout has not
	// yet expired.
	//
	// * You can use ReceiveRequestAttemptId only for 5 minutes after a
	// ReceiveMessage action.
	//
	// * When you set FifoQueue, a caller of the ReceiveMessage
	// action can provide a ReceiveRequestAttemptId explicitly.
	//
	// * If a caller of the
	// ReceiveMessage action doesn't provide a ReceiveRequestAttemptId, Amazon SQS
	// generates a ReceiveRequestAttemptId.
	//
	// * It is possible to retry the
	// ReceiveMessage action with the same ReceiveRequestAttemptId if none of the
	// messages have been modified (deleted or had their visibility changes).
	//
	// * During
	// a visibility timeout, subsequent calls with the same ReceiveRequestAttemptId
	// return the same messages and receipt handles. If a retry occurs within the
	// deduplication interval, it resets the visibility timeout. For more information,
	// see Visibility Timeout
	// (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html)
	// in the Amazon SQS Developer Guide. If a caller of the ReceiveMessage action
	// still processes messages when the visibility timeout expires and messages become
	// visible, another worker consuming from the same queue can receive the same
	// messages and therefore process duplicates. Also, if a consumer whose message
	// processing time is longer than the visibility timeout tries to delete the
	// processed messages, the action fails with an error. To mitigate this effect,
	// ensure that your application observes a safe threshold before the visibility
	// timeout expires and extend the visibility timeout as necessary.
	//
	// * While
	// messages with a particular MessageGroupId are invisible, no more messages
	// belonging to the same MessageGroupId are returned until the visibility timeout
	// expires. You can still receive messages with another MessageGroupId as long as
	// it is also visible.
	//
	// * If a caller of ReceiveMessage can't track the
	// ReceiveRequestAttemptId, no retries work until the original visibility timeout
	// expires. As a result, delays might occur but the messages in the queue remain in
	// a strict order.
	//
	// The maximum length of ReceiveRequestAttemptId is 128
	// characters. ReceiveRequestAttemptId can contain alphanumeric characters (a-z,
	// A-Z, 0-9) and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~). For best practices
	// of using ReceiveRequestAttemptId, see Using the ReceiveRequestAttemptId Request
	// Parameter
	// (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-receiverequestattemptid-request-parameter.html)
	// in the Amazon SQS Developer Guide.
	ReceiveRequestAttemptId *string

	// The duration (in seconds) that the received messages are hidden from subsequent
	// retrieve requests after being retrieved by a ReceiveMessage request.
	VisibilityTimeout int32

	// The duration (in seconds) for which the call waits for a message to arrive in
	// the queue before returning. If a message is available, the call returns sooner
	// than WaitTimeSeconds. If no messages are available and the wait time expires,
	// the call returns successfully with an empty list of messages. To avoid HTTP
	// errors, ensure that the HTTP response timeout for ReceiveMessage requests is
	// longer than the WaitTimeSeconds parameter. For example, with the Java SDK, you
	// can set HTTP transport settings using the  NettyNioAsyncHttpClient
	// (https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClient.html)
	// for asynchronous clients, or the  ApacheHttpClient
	// (https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/apache/ApacheHttpClient.html)
	// for synchronous clients.
	WaitTimeSeconds int32

	// MessageSystemAttributeNames include:
	// 	- All – Returns all values.
	// 	- ApproximateFirstReceiveTimestamp – Returns the time the message was first received from the queue (epoch time in milliseconds).
	// 	- ApproximateReceiveCount – Returns the number of times a message has been received across all queues but not deleted.
	// 	- AWSTraceHeader – Returns the AWS X-Ray trace header string.
	// 	- SenderId
	// 		- For a user, returns the user ID, for example ABCDEFGHI1JKLMNOPQ23R.
	// 		- For an IAM role, returns the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456.
	// 	- SentTimestamp – Returns the time the message was sent to the queue (epoch time in milliseconds).
	// 	- SqsManagedSseEnabled – Enables server-side queue encryption using SQS owned encryption keys. Only one server-side encryption option is supported per queue (for example, SSE-KMS or SSE-SQS).
	// 	- MessageDeduplicationId – Returns the value provided by the producer that calls the SendMessage action.
	// 	- MessageGroupId – Returns the value provided by the producer that calls the SendMessage action. Messages with the same MessageGroupId are returned in sequence.
	// 	- SequenceNumber – Returns the value provided by Amazon SQS.
	// for details you can visit https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html
	MessageSystemAttributeName []string

	noSmithyDocumentSerde
}

Current Behavior

aws/aws-sdk-go-v2/service/[email protected]/api_op_ReceiveMessage.go

type ReceiveMessageInput struct {

	// The URL of the Amazon SQS queue from which messages are received. Queue URLs
	// and names are case-sensitive.
	//
	// This member is required.
	QueueUrl *string

	// A list of attributes that need to be returned along with each message. These
	// attributes include:
	//   - All – Returns all values.
	//   - ApproximateFirstReceiveTimestamp – Returns the time the message was first
	//   received from the queue ( epoch time (http://en.wikipedia.org/wiki/Unix_time)
	//   in milliseconds).
	//   - ApproximateReceiveCount – Returns the number of times a message has been
	//   received across all queues but not deleted.
	//   - AWSTraceHeader – Returns the X-Ray trace header string.
	//   - SenderId
	//   - For a user, returns the user ID, for example ABCDEFGHI1JKLMNOPQ23R .
	//   - For an IAM role, returns the IAM role ID, for example
	//   ABCDE1F2GH3I4JK5LMNOP:i-a123b456 .
	//   - SentTimestamp – Returns the time the message was sent to the queue ( epoch
	//   time (http://en.wikipedia.org/wiki/Unix_time) in milliseconds).
	//   - SqsManagedSseEnabled – Enables server-side queue encryption using SQS owned
	//   encryption keys. Only one server-side encryption option is supported per queue
	//   (for example, SSE-KMS (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html)
	//   or SSE-SQS (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html)
	//   ).
	//   - MessageDeduplicationId – Returns the value provided by the producer that
	//   calls the SendMessage action.
	//   - MessageGroupId – Returns the value provided by the producer that calls the
	//   SendMessage action. Messages with the same MessageGroupId are returned in
	//   sequence.
	//   - SequenceNumber – Returns the value provided by Amazon SQS.
	AttributeNames []types.QueueAttributeName

	// The maximum number of messages to return. Amazon SQS never returns more
	// messages than this value (however, fewer messages might be returned). Valid
	// values: 1 to 10. Default: 1.
	MaxNumberOfMessages int32

	// The name of the message attribute, where N is the index.
	//   - The name can contain alphanumeric characters and the underscore ( _ ),
	//   hyphen ( - ), and period ( . ).
	//   - The name is case-sensitive and must be unique among all attribute names for
	//   the message.
	//   - The name must not start with AWS-reserved prefixes such as AWS. or Amazon.
	//   (or any casing variants).
	//   - The name must not start or end with a period ( . ), and it should not have
	//   periods in succession ( .. ).
	//   - The name can be up to 256 characters long.
	// When using ReceiveMessage , you can send a list of attribute names to receive,
	// or you can return all of the attributes by specifying All or .* in your
	// request. You can also use all message attributes starting with a prefix, for
	// example bar.* .
	MessageAttributeNames []string

	// This parameter applies only to FIFO (first-in-first-out) queues. The token used
	// for deduplication of ReceiveMessage calls. If a networking issue occurs after a
	// ReceiveMessage action, and instead of a response you receive a generic error, it
	// is possible to retry the same action with an identical ReceiveRequestAttemptId
	// to retrieve the same set of messages, even if their visibility timeout has not
	// yet expired.
	//   - You can use ReceiveRequestAttemptId only for 5 minutes after a
	//   ReceiveMessage action.
	//   - When you set FifoQueue , a caller of the ReceiveMessage action can provide a
	//   ReceiveRequestAttemptId explicitly.
	//   - If a caller of the ReceiveMessage action doesn't provide a
	//   ReceiveRequestAttemptId , Amazon SQS generates a ReceiveRequestAttemptId .
	//   - It is possible to retry the ReceiveMessage action with the same
	//   ReceiveRequestAttemptId if none of the messages have been modified (deleted or
	//   had their visibility changes).
	//   - During a visibility timeout, subsequent calls with the same
	//   ReceiveRequestAttemptId return the same messages and receipt handles. If a
	//   retry occurs within the deduplication interval, it resets the visibility
	//   timeout. For more information, see Visibility Timeout (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html)
	//   in the Amazon SQS Developer Guide. If a caller of the ReceiveMessage action
	//   still processes messages when the visibility timeout expires and messages become
	//   visible, another worker consuming from the same queue can receive the same
	//   messages and therefore process duplicates. Also, if a consumer whose message
	//   processing time is longer than the visibility timeout tries to delete the
	//   processed messages, the action fails with an error. To mitigate this effect,
	//   ensure that your application observes a safe threshold before the visibility
	//   timeout expires and extend the visibility timeout as necessary.
	//   - While messages with a particular MessageGroupId are invisible, no more
	//   messages belonging to the same MessageGroupId are returned until the
	//   visibility timeout expires. You can still receive messages with another
	//   MessageGroupId as long as it is also visible.
	//   - If a caller of ReceiveMessage can't track the ReceiveRequestAttemptId , no
	//   retries work until the original visibility timeout expires. As a result, delays
	//   might occur but the messages in the queue remain in a strict order.
	// The maximum length of ReceiveRequestAttemptId is 128 characters.
	// ReceiveRequestAttemptId can contain alphanumeric characters ( a-z , A-Z , 0-9 )
	// and punctuation ( !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ ). For best practices of
	// using ReceiveRequestAttemptId , see Using the ReceiveRequestAttemptId Request
	// Parameter (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-receiverequestattemptid-request-parameter.html)
	// in the Amazon SQS Developer Guide.
	ReceiveRequestAttemptId *string

	// The duration (in seconds) that the received messages are hidden from subsequent
	// retrieve requests after being retrieved by a ReceiveMessage request.
	VisibilityTimeout int32

	// The duration (in seconds) for which the call waits for a message to arrive in
	// the queue before returning. If a message is available, the call returns sooner
	// than WaitTimeSeconds . If no messages are available and the wait time expires,
	// the call returns successfully with an empty list of messages. To avoid HTTP
	// errors, ensure that the HTTP response timeout for ReceiveMessage requests is
	// longer than the WaitTimeSeconds parameter. For example, with the Java SDK, you
	// can set HTTP transport settings using the NettyNioAsyncHttpClient (https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClient.html)
	// for asynchronous clients, or the ApacheHttpClient (https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/apache/ApacheHttpClient.html)
	// for synchronous clients.
	WaitTimeSeconds int32

	noSmithyDocumentSerde
}

Reproduction Steps

Check the main branch or the latest version of SDK the MessageSystemAttributeName still missing from api_op_ReceiveMessage

Possible Solution

add MessageSystemAttributeName []string into ReceiveMessageInput struct

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go v1.44.11
github.com/aws/aws-sdk-go-v2 v1.21.1
github.com/aws/aws-sdk-go-v2/config v1.15.5
github.com/aws/aws-sdk-go-v2/credentials v1.12.0
github.com/aws/aws-sdk-go-v2/service/sns v1.22.1
github.com/aws/aws-sdk-go-v2/service/sqs v1.24.6

Compiler and Version used

1.20

Operating System and version

macOS 13.0.1

@hryer hryer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 8, 2024
@RanVaknin RanVaknin self-assigned this Jan 8, 2024
@hryer
Copy link
Author

hryer commented Jan 9, 2024

@RanVaknin Hi sorry to bother, any updates about this issues?

If you don't mind, I'll add PR to solve this.

@RanVaknin
Copy link
Contributor

Hi @hryer ,

This is likely related to
aws/aws-sdk#623
aws/aws-sdk-js-v3#5403

and is not something we can solve on the SDK. This is likely due to a modeling issue with the SQS API model itself.

@RanVaknin Hi sorry to bother, any updates about this issues?

If you don't mind, I'll add PR to solve this.

This is not something you can fix through the SDK. If you look at the top of the file you mentioned it says the following

// Code generated by smithy-go-codegen DO NOT EDIT.

Indicating that this is code generated from the API model and has to be solved upstream.

Im going to reach out to the SQS team again to see if we can get their attention on this.
Thanks,
Ran~

@hryer
Copy link
Author

hryer commented Jan 9, 2024

I see so for now to solve these problems for now just use the AttributeNames right? back to the old ways?

Thank's for answering

@RanVaknin RanVaknin added duplicate This issue is a duplicate. service-api This issue is due to a problem in a service API, not the SDK implementation. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jan 9, 2024
@RanVaknin
Copy link
Contributor

Hi @hryer ,

I just reached out to the SQS team and it seems like they are going to deploy the changes in the near future. In the meantime you can safely use AttributeNames.
Since this issue is a duplicate, I'm going to close it in favor of tracking it here.

Thanks again,
Ran~

@RanVaknin RanVaknin closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2024
Copy link

github-actions bot commented Jan 9, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. duplicate This issue is a duplicate. p2 This is a standard priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants