question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Date parsing issue in MSIToken [BUG]

See original GitHub issue

Describe the bug

Azure App Service Environment MSI endpoint is returning a JWT token with an expires_on with “AM” in it. “12/19/2019 5:03:41 AM +00:00”

parseDateToEpochSeconds() in MSIToken is parsing with a fixed pattern of “MM/dd/yyyy HH:mm:ss XXX” which will not parse with the expires_on coming from the MSI endpoint.

Exception or Stack Trace Suppressed: com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of com.azure.identity.implementation.MSIToken, problem: Unable to parse date time 12/19/2019 5:03:41 AM +00:00 at [Source: (String)“{“access_token”:”…"[truncated 1060 chars]; line: 1, column: 1427] at com.fasterxml.jackson.databind.exc.ValueInstantiationException.from(ValueInstantiationException.java:47) at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1732) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.wrapAsJsonMappingException(StdValueInstantiator.java:491) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.rewrapCtorProblem(StdValueInstantiator.java:514) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:285) at com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:229) at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:198) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:422) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1287) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205) at com.azure.core.util.serializer.JacksonAdapter.deserialize(JacksonAdapter.java:174) at com.azure.identity.implementation.IdentityClient.authenticateToManagedIdentityEndpoint(IdentityClient.java:350) at com.azure.identity.AppServiceMsiCredential.authenticate(AppServiceMsiCredential.java:53) at com.azure.identity.ManagedIdentityCredential.getToken(ManagedIdentityCredential.java:57) at com.azure.identity.ChainedTokenCredential.lambda$getToken$1(ChainedTokenCredential.java:40) at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:378) … 60 common frames omitted Caused by: java.lang.IllegalArgumentException: Unable to parse date time 12/19/2019 5:03:41 AM +00:00 at com.azure.identity.implementation.MSIToken.parseDateToEpochSeconds(MSIToken.java:83) at com.azure.identity.implementation.MSIToken.<init>(MSIToken.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:124) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:283) … 74 common frames omitted

To Reproduce Use DefaultAzureCredentialBuilder to build credentials in an App Service Environment. The impacted one is in US East, so the ASE’s locale may have something to do with this issue.

Setup (please complete the following information):

  • Version:
            <dependency>
    		<groupId>com.azure</groupId>
    		<artifactId>azure-identity</artifactId>
    		<version>1.0.1</version>
    	</dependency>
    

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
athempelcommented, Jun 29, 2020

The problem seems to have started again. Using 1.1.0-beta.3

3reactions
jonno85commented, Jul 21, 2020

@Luyunmt

using the version 1.1.0-beta.6, the problem still seems to be there:

Cannot construct instance of com.azure.identity.implementation.MSIToken, problem: Unable to parse date time 7/21/2020 12:54:17 PM +00:00

I am using a Windows AppService

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Date parsing issue in MSIToken - Stack Overflow
Describe the bug. Azure App Service Environment MSI endpoint is returning a JWT token with an expires_on with "AM" in it.
Read more >
How to use managed identities for Azure resources on an ...
Step-by-step instructions and examples for using managed identities for Azure resources on virtual machines to acquire an OAuth access ...
Read more >
Service to Service Auth with Azure AD, MSI & OAuth 2.0 (Step ...
We now have the ability to issue access tokens that contain any number of custom app roles; Below I describe how service A...
Read more >
What do the various Windows Installer (MSI) error codes mean?
The errors returned by the Windows Installer service are unique to MSI ... 1259: This error code only occurs when using Windows Installer...
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/14 12 ...
Bug :128538 - "sys-apps/coreutils: /bin/hostname should be installed from ... syntax error near unexpected token `-Wno-format-overflow,'" status:UNCONFIRMED ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found