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

S3 Expires Header throws AmazonUnmarshallingException #253

Closed
brianfeucht opened this issue Oct 7, 2015 · 12 comments
Closed

S3 Expires Header throws AmazonUnmarshallingException #253

brianfeucht opened this issue Oct 7, 2015 · 12 comments
Labels
bug This issue is a bug. queued s3

Comments

@brianfeucht
Copy link

I am getting back the following header during a HEAD request to S3:

Expires: Thu, 31 Dec 2057 23:55:55 GMT

This causes:

Amazon.Runtime.AmazonUnmarshallingException: Error unmarshalling response back from AWS.  ---> System.FormatException: String was not recognized as a valid DateTime because the day of week was incorrect.
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.Convert.ToDateTime(String value, IFormatProvider provider)
   at System.String.System.IConvertible.ToDateTime(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Amazon.S3.Model.Internal.MarshallTransformations.S3Transforms.ToDateTime(String value) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\S3Transforms.cs:line 79
   at Amazon.S3.Model.Internal.MarshallTransformations.GetObjectMetadataResponseUnmarshaller.UnmarshallResult(XmlUnmarshallerContext context, GetObjectMetadataResponse response) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\GetObjectMetadataResponseUnmarshaller.cs:line 83
   at Amazon.S3.Model.Internal.MarshallTransformations.GetObjectMetadataResponseUnmarshaller.Unmarshall(XmlUnmarshallerContext context) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\GetObjectMetadataResponseUnmarshaller.cs:line 38
   at Amazon.Runtime.Internal.Transform.XmlResponseUnmarshaller.Unmarshall(UnmarshallerContext input) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 94
   at Amazon.Runtime.Internal.Transform.S3ReponseUnmarshaller.Unmarshall(UnmarshallerContext input) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 179
   at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.UnmarshallResponse(UnmarshallerContext context) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 62
   at Amazon.Runtime.Internal.Unmarshaller.UnmarshallResponse(UnmarshallerContext context, IRequestContext requestContext) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 208
   at Amazon.Runtime.Internal.Unmarshaller.Unmarshall(IExecutionContext executionContext) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 134
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.Unmarshaller.Unmarshall(IExecutionContext executionContext) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 149
   at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 70
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.S3.Internal.AmazonS3ResponseHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Internal\AmazonS3ResponseHandler.cs:line 56
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__1`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 105
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CredentialsRetriever.cs:line 98
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\RetryHandler\RetryHandler.cs:line 129
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.S3.Internal.AmazonS3ExceptionHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Internal\AmazonS3ExceptionHandler.cs:line 53
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\ErrorCallbackHandler.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\MetricsHandler.cs:line 65
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Core.Amazon.S3.ServerSideEncryptedS3File.<>c__DisplayClass6.<<FilesInBucketNotEncrypted>b__3>d__8.MoveNext() in c:\dev\litmus.net\Core\Core.Amazon\S3\ServerSideEncryptedS3File.cs:line 114
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Core.Extensions.LinqExtensions.<>c__DisplayClass12`1.<>c__DisplayClass14.<<ForEachAsync>b__11>d__16.MoveNext() in c:\dev\litmus.net\Core\Core\Extensions\LinqExtensions.cs:line 68
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Core.Amazon.S3.ServerSideEncryptedS3File.<FilesInBucketNotEncrypted>d__e.MoveNext() in c:\dev\litmus.net\Core\Core.Amazon\S3\ServerSideEncryptedS3File.cs:line 108
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at EmailAnalytics.Tasks.Maintenance.ConvertBucketToServerSideEncryptedFiles.<EnquequeItems>d__9.MoveNext() in c:\dev\litmus.net\EmailAnalytics.Tasks\EmailAnalytics.Tasks.Maintenance\ConvertBucketToServerSideEncryptedFiles.cs:line 54
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at EmailAnalytics.Tasks.Maintenance.Program.Main(String[] args) in c:\dev\litmus.net\EmailAnalytics.Tasks\EmailAnalytics.Tasks.Maintenance\Program.cs:line 123
---> (Inner Exception #0) Amazon.Runtime.AmazonUnmarshallingException: Error unmarshalling response back from AWS.  ---> System.FormatException: String was not recognized as a valid DateTime because the day of week was incorrect.
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.Convert.ToDateTime(String value, IFormatProvider provider)
   at System.String.System.IConvertible.ToDateTime(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Amazon.S3.Model.Internal.MarshallTransformations.S3Transforms.ToDateTime(String value) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\S3Transforms.cs:line 79
   at Amazon.S3.Model.Internal.MarshallTransformations.GetObjectMetadataResponseUnmarshaller.UnmarshallResult(XmlUnmarshallerContext context, GetObjectMetadataResponse response) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\GetObjectMetadataResponseUnmarshaller.cs:line 83
   at Amazon.S3.Model.Internal.MarshallTransformations.GetObjectMetadataResponseUnmarshaller.Unmarshall(XmlUnmarshallerContext context) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\GetObjectMetadataResponseUnmarshaller.cs:line 38
   at Amazon.Runtime.Internal.Transform.XmlResponseUnmarshaller.Unmarshall(UnmarshallerContext input) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 94
   at Amazon.Runtime.Internal.Transform.S3ReponseUnmarshaller.Unmarshall(UnmarshallerContext input) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 179
   at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.UnmarshallResponse(UnmarshallerContext context) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 62
   at Amazon.Runtime.Internal.Unmarshaller.UnmarshallResponse(UnmarshallerContext context, IRequestContext requestContext) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 208
   at Amazon.Runtime.Internal.Unmarshaller.Unmarshall(IExecutionContext executionContext) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 134
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.Unmarshaller.Unmarshall(IExecutionContext executionContext) in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 149
   at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\Unmarshaller.cs:line 70
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.S3.Internal.AmazonS3ResponseHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Internal\AmazonS3ResponseHandler.cs:line 56
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__1`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 105
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CredentialsRetriever.cs:line 98
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\RetryHandler\RetryHandler.cs:line 129
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.S3.Internal.AmazonS3ExceptionHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.S3\Internal\AmazonS3ExceptionHandler.cs:line 53
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\ErrorCallbackHandler.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__0`1.MoveNext() in c:\code\aws-sdk-net\AWSSDK_DotNet35\Amazon.Runtime\Pipeline\Handlers\MetricsHandler.cs:line 65

This appears to be the issue:
https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetObjectMetadataResponseUnmarshaller.cs#L83

I can reproduce with the following test case:

    var value = "Thu, 31 Dec 2057 23:55:55 GMT";
    DateTime result = (DateTime)Convert.ChangeType(value, typeof(DateTime), System.Globalization.CultureInfo.InvariantCulture);
    result = result.ToUniversalTime();
@brianfeucht brianfeucht changed the title S3 Expires Header throws Unable S3 Expires Header throws AmazonUnmarshallingException Oct 7, 2015
@brianfeucht
Copy link
Author

This could be an S3 bug as 12/31/2057 is a Monday.

@PavelSafronov
Copy link

Do you know how the Expires header was set on the object in the first place? S3 will accept any header value, which it will then return, so I believe the issue is with the code that initially set this header to the invalid value in the first place.

@PavelSafronov
Copy link

This is a duplicate of an earlier issue - #202

@brianfeucht
Copy link
Author

I found the code which is making this mess. It is some internal s3 code which was written prior to adopting this sdk.

Would it make sense to return the partially parsed response object with the exception so it can be used to fix the issue?

Feel free to close this if not.

@gokarnm
Copy link
Contributor

gokarnm commented Oct 7, 2015

We are considering a solution where we would return a partial response in case we are not able to parse certain headers. I'll update this issue when we implement this fix.

@gokarnm
Copy link
Contributor

gokarnm commented Oct 27, 2015

There is a fix available for this in the latest version of the S3 SDK (3.1.3.3). The SDK will lazily parse the Expires header only when GetObjectMetadataResponse.Expires or GetObjectResponse.Expires property is accessed. The property will throw an AmazonDateTimeUnmarshallingException if the response contains an Expires header with an invalid value.

@bhattfrequent
Copy link

bhattfrequent commented Oct 5, 2017

I still face this issue even in the latest versions of dll
AWSSDK.Core 3.3.17.5
AWSSDK.S3 3.3.9

If i put an object today (5th oct 2017) in the bucket and set the lifecycle policy of bucket as
Expiration = new LifecycleRuleExpiration() {Days = 2}

Now when i try to get the object or get the header of object then i get AmazonUnmarshallingException - The string was not recognized as a valid DateTime error.
What i have noticed is "For any object if the Expiry comes out to be any date between 1-9 of any month then i get this exception.
In my case object creation date is 5th oct 2017 , it will expire after two days hence it's Expiry in the object header will be 7th oct 2017 which is between (1< 7 <=9) so i get the exception.
Can someone comment on this issue i am facing?

Here is the code i am using to set LifecycleRule

PutLifecycleConfigurationRequest lifecycleConfigurationRequest = new PutLifecycleConfigurationRequest()
{
BucketName = bucketName,
Configuration = new LifecycleConfiguration()
{
Rules = new List()
{
new LifecycleRule()
{
Expiration = new LifecycleRuleExpiration() {Days = daysAfterWhichObjectExpire},
Id = Guid.NewGuid().ToString(),
Status = LifecycleRuleStatus.Enabled,
Prefix = ""
}
}
}
};

@diehlaws diehlaws added guidance Question that needs advice or information. and removed Question labels Jan 3, 2019
@suadev
Copy link

suadev commented Nov 29, 2022

We are facing the same issue.

@splitice
Copy link

splitice commented Jan 1, 2024

Can confirm this issue still exists

@dscpinheiro
Copy link
Contributor

Re-opening this issue so we don't lose track of it.

We're investigating a fix internally, it requires coordination with the other SDKs and S3.

@dscpinheiro dscpinheiro reopened this Jan 2, 2024
@dscpinheiro dscpinheiro added bug This issue is a bug. s3 queued and removed guidance Question that needs advice or information. labels Jan 2, 2024
@muhammad-othman
Copy link
Member

Since S3 will accept any header value, which it will then return and might cause the parsing exception, we've added a new property ExpiresString to GetObjectResponse and GetObjectMetadataResponse, and will contain the unparsed value returned from S3 (regardless if parsing succeeds or not) and should be used instead of Expires (which has been deprecated).
Expires property will be kept for backward compatibility and it will be set to null if parsing failed.

Copy link

github-actions bot commented Apr 9, 2024

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. queued s3
Projects
None yet
Development

No branches or pull requests

9 participants