none
Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications. RRS feed

  • Question

  • I am trying to call Cosmos DB get collections API from Data Factory Web Activity. I am passing the 'x-ms-date' header as per the RFC 1123 date-time specification for ex "Thu, 1 Aug 2019 08:28:31 GMT".

    This was working fine couple of days of back but when i tried to run the pipeline today I got following unauthorized error:

    "Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications."

    I am not sure what’s the issue here as I did not change any header parameters.

    Please help. Thanks.

    Thursday, August 1, 2019 8:38 AM

All replies

  • Hi Pushpraj153,

    Are you in control of the data load to CosmosDB? If you are, can you investigate to see if something has changed with the source data over the past week by querying the data from a period when it worked and from after the first.

    This is a methodology to identify where the issue resides. There are three possible issues:

    • The source data (load) has changed.
    • The CosmosDB service has changed.
    • The Azure Data Factory service has changed.

    With this information we can figure out next steps. Apologies for the delay in responding to this issue but I hope that we can get the issue identified. If you have already resolved this, can you please post the resolution as it is helpful to others who may encounter the same issue.

    Regards,

    Mike

    Tuesday, August 6, 2019 3:54 PM
    Moderator
  • Hi Pushpraj153,

    Did you get this resolved or are you still needing assistance with this issue?

    Regards,

    Mike

    Thursday, August 8, 2019 10:56 PM
    Moderator
  • Hi Pushpraj153,

    Did you get this resolved or are you still needing assistance with this issue?

    Regards,

    Mike

    Hi, 

    I have same issue on Azure Java SDK.

    Please check debug log for details.

    >> x-ms-date: Tue, 10 Sep 2019 02:37:39 +00:00

    Date: Tue, 10 Sep 2019 02:37:39 GMT

    Exception in thread "main" java.lang.IllegalStateException: com.microsoft.azure.documentdb.DocumentClientException: Message: {"Errors":["Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications.","Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications."]}



    2019-09-10 11:37:39,326       [main] INFO  com.microsoft.azure.documentdb.DocumentClient - Initializing DocumentClient with serviceEndpoint [https://{myhost}.documents.azure.com:443/], ConnectionPolicy [ConnectionPolicy [requestTimeout=60, directRequestTimeout5, mediaRequestTimeout=300, connectionMode=Gateway, mediaReadMode=Buffered, maxPoolSize=800, idleConnectionTimeout=60, userAgentSuffix=, retryOptions=com.microsoft.azure.documentdb.RetryOptions@25a65b77, enableEndpointDiscovery=true, preferredLocations=null, usingMultipleWriteLocations=false, handleServiceUnavailableFromProxy=false]], ConsistencyLevel [Session]
    2019-09-10 11:37:39,674       [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
    2019-09-10 11:37:39,675       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://{myhost}.documents.azure.com:443][total kept alive: 0; route allocated: 0 of 800; total allocated: 0 of 800]
    2019-09-10 11:37:39,684       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://{myhost}.documents.azure.com:443][total kept alive: 0; route allocated: 1 of 800; total allocated: 1 of 800]
    2019-09-10 11:37:39,685       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://{myhost}.documents.azure.com:443
    2019-09-10 11:37:39,692       [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to {myhost}.documents.azure.com/104.41.177.93:443
    2019-09-10 11:37:39,692       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to {myhost}.documents.azure.com/104.41.177.93:443 with timeout 60000
    2019-09-10 11:37:39,721       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
    ...
    2019-09-10 11:37:39,721       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
    2019-09-10 11:37:39,797       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Secure session established
    2019-09-10 11:37:39,797       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  negotiated protocol: TLSv1.2
    2019-09-10 11:37:39,797       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    2019-09-10 11:37:39,797       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  peer principal: CN=*.documents.azure.com
    2019-09-10 11:37:39,798       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  peer alternative names: [*.documents.azure.com]
    2019-09-10 11:37:39,798       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  issuer principal: CN=Microsoft IT TLS CA 5, OU=Microsoft IT, O=Microsoft Corporation, L=Redmond, ST=Washington, C=US
    2019-09-10 11:37:39,801       [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established {myip}:57833<->104.41.177.93:443
    2019-09-10 11:37:39,801       [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 60000
    2019-09-10 11:37:39,801       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request GET / HTTP/1.1
    2019-09-10 11:37:39,801       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
    2019-09-10 11:37:39,802       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> GET / HTTP/1.1
    2019-09-10 11:37:39,802       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> x-ms-version: 2018-09-17
    2019-09-10 11:37:39,802       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Cache-Control: no-cache
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: MacOSX/10.14.6 JRE/1.8.0_191 documentdb-java-sdk/2.4.1
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> x-ms-consistency-level: Session
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> authorization: xxx
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/json
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> x-ms-date: Tue, 10 Sep 2019 02:37:39 +00:00
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: {myhost}.documents.azure.com:443
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "GET / HTTP/1.1[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "x-ms-version: 2018-09-17[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Cache-Control: no-cache[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: MacOSX/10.14.6 JRE/1.8.0_191 documentdb-java-sdk/2.4.1[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "x-ms-consistency-level: Session[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "authorization: type%3xxx[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/json[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "x-ms-date: Tue, 10 Sep 2019 02:37:39 +00:00[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: {myhost}.documents.azure.com:443[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
    2019-09-10 11:37:39,803       [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 Ok[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Cache-Control: no-store, no-cache[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Pragma: no-cache[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: application/json[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Location: https://{myhost}.documents.azure.com/[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Server: Microsoft-HTTPAPI/2.0[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "x-ms-max-media-storage-usage-mb: 2048[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "x-ms-media-storage-usage-mb: 0[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "x-ms-databaseaccount-consumed-mb: 0[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "x-ms-databaseaccount-reserved-mb: 0[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "x-ms-databaseaccount-provisioned-mb: 0[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Strict-Transport-Security: max-age=31536000[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "x-ms-gatewayversion: version=2.5.1[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Tue, 10 Sep 2019 02:37:39 GMT[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
    2019-09-10 11:37:39,821       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "557[\r][\n]"
    ...
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 Ok
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Cache-Control: no-store, no-cache
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Pragma: no-cache
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Transfer-Encoding: chunked
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: application/json
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Location: https://{myhost}.documents.azure.com/
    2019-09-10 11:37:39,823       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Server: Microsoft-HTTPAPI/2.0
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << x-ms-max-media-storage-usage-mb: 2048
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << x-ms-media-storage-usage-mb: 0
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << x-ms-databaseaccount-consumed-mb: 0
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << x-ms-databaseaccount-reserved-mb: 0
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << x-ms-databaseaccount-provisioned-mb: 0
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Strict-Transport-Security: max-age=31536000
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << x-ms-gatewayversion: version=2.5.1
    2019-09-10 11:37:39,824       [main] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Tue, 10 Sep 2019 02:37:39 GMT
    2019-09-10 11:37:39,828       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive indefinitely
    2019-09-10 11:37:39,833       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "0[\r][\n]"
    2019-09-10 11:37:39,833       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
    2019-09-10 11:37:39,833       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 0][route: {s}->https://{myhost}.documents.azure.com:443] can be kept alive indefinitely
    2019-09-10 11:37:39,833       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->https://{myhost}.documents.azure.com:443][total kept alive: 1; route allocated: 1 of 800; total allocated: 1 of 800]
    2019-09-10 11:37:39,845       [main] DEBUG com.microsoft.azure.documentdb.GlobalEndpointManager - Refreshing endpoints list
    2019-09-10 11:37:39,850       [main] DEBUG com.microsoft.azure.documentdb.DocumentClient - Querying Databases. querySpec: [{"query":"SELECT * FROM root r WHERE r.id='ToDoList'"}]
    2019-09-10 11:37:39,855       [main] WARN  com.microsoft.azure.documentdb.internal.ServiceJNIWrapper - 'Mac OS X' with 'x86_64' system is not compatible with native library. JNI not loaded.
    2019-09-10 11:37:39,868       [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
    2019-09-10 11:37:39,869       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://{myhost}-japaneast.documents.azure.com:443][total kept alive: 1; route allocated: 0 of 800; total allocated: 1 of 800]
    2019-09-10 11:37:39,869       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 1][route: {s}->https://{myhost}-japaneast.documents.azure.com:443][total kept alive: 1; route allocated: 1 of 800; total allocated: 2 of 800]
    2019-09-10 11:37:39,869       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://{myhost}-japaneast.documents.azure.com:443
    2019-09-10 11:37:39,872       [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to {myhost}-japaneast.documents.azure.com/104.41.177.93:443
    2019-09-10 11:37:39,873       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to {myhost}-japaneast.documents.azure.com/104.41.177.93:443 with timeout 60000
    2019-09-10 11:37:39,882       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
    ...
    2019-09-10 11:37:39,882       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Secure session established
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  negotiated protocol: TLSv1.2
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  peer principal: CN=*.documents.azure.com
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  peer alternative names: [*.documents.azure.com]
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  issuer principal: CN=Microsoft IT TLS CA 5, OU=Microsoft IT, O=Microsoft Corporation, L=Redmond, ST=Washington, C=US
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established {myip}:57834<->104.41.177.93:443
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-1: set socket timeout to 60000
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /dbs HTTP/1.1
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> POST /dbs HTTP/1.1
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> x-ms-version: 2018-09-17
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Cache-Control: no-cache
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> User-Agent: MacOSX/10.14.6 JRE/1.8.0_191 documentdb-java-sdk/2.4.1
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> x-ms-consistency-level: Session
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> authorization: xxx
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Accept: application/json
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> x-ms-date: Tue, 10 Sep 2019 02:37:39 +00:00
    2019-09-10 11:37:39,922       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> x-ms-documentdb-isquery: true
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Content-Type: application/query+json
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Content-Length: 54
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Host: {myhost}-japaneast.documents.azure.com:443
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Connection: Keep-Alive
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.headers - http-outgoing-1 >> Accept-Encoding: gzip,deflate
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "POST /dbs HTTP/1.1[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "x-ms-version: 2018-09-17[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Cache-Control: no-cache[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "User-Agent: MacOSX/10.14.6 JRE/1.8.0_191 documentdb-java-sdk/2.4.1[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "x-ms-consistency-level: Session[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "authorization: xxx[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Accept: application/json[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "x-ms-date: Tue, 10 Sep 2019 02:37:39 +00:00[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "x-ms-documentdb-isquery: true[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Content-Type: application/query+json[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Content-Length: 54[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Host: {myhost}-japaneast.documents.azure.com:443[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "[\r][\n]"
    2019-09-10 11:37:39,923       [main] DEBUG org.apache.http.wire - http-outgoing-1 >> "{"query":"SELECT * FROM root r WHERE r.id='ToDoList'"}"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "HTTP/1.1 401 Unauthorized[\r][\n]"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "Transfer-Encoding: chunked[\r][\n]"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "Content-Type: application/json[\r][\n]"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "Server: Microsoft-HTTPAPI/2.0[\r][\n]"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-last-state-change-utc: Thu, 05 Sep 2019 22:32:43.359 GMT[\r][\n]"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "lsn: 9[\r][\n]"
    2019-09-10 11:37:39,935       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-schemaversion: 1.8[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-xp-role: 2[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-global-Committed-lsn: 9[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-number-of-read-regions: 0[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-transport-request-id: xxx[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-cosmos-llsn: 9[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-session-token: 0:-1#9[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-serviceversion: version=2.5.0.0[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-activity-id: xxx[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-request-charge: 0[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "Strict-Transport-Security: max-age=31536000[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "x-ms-gatewayversion: version=2.5.1[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "Date: Tue, 10 Sep 2019 02:37:39 GMT[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "72C[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "{"code":"Unauthorized","message":"Message: {\"Errors\":[\"Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications.\",\"Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications.\"]}\r\nActivityId: xxx, Request URI: /apps/xxx, RequestStats: \r\nRequestStartTime: 2019-09-10T02:37:39.9315512Z, RequestEndTime: 2019-09-10T02:37:39.9315512Z, Number of regions attempted: 1\r\nResponseTime: 2019-09-10T02:37:39.9315512Z, StoreResult: StorePhysicalAddress: rntbd://xxx:11000/apps/xxx, LSN: 9, GlobalCommittedLsn: 9, PartitionKeyRangeId: , IsValid: True, StatusCode: 401, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: -1#9, UsingLocalLSN: False, TransportException: null, ResourceType: Database, OperationType: Query\r\nResponseTime: 2019-09-10T02:37:39.9315512Z, StoreResult: StorePhysicalAddress: rntbd://xxx:11000/apps/xxx, LSN: 9, GlobalCommittedLsn: 9, PartitionKeyRangeId: , IsValid: True, StatusCode: 401, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: -1#9, UsingLocalLSN: False, TransportException: null, ResourceType: Database, OperationType: Query\r\n, SDK: Microsoft.Azure.Documents.Common/2.5.1"}[\r][\n]"
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << HTTP/1.1 401 Unauthorized
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << Transfer-Encoding: chunked
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << Content-Type: application/json
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << Server: Microsoft-HTTPAPI/2.0
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-last-state-change-utc: Thu, 05 Sep 2019 22:32:43.359 GMT
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << lsn: 9
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-schemaversion: 1.8
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-xp-role: 2
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-global-Committed-lsn: 9
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-number-of-read-regions: 0
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-transport-request-id: xxx
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-cosmos-llsn: 9
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-session-token: 0:-1#9
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-serviceversion: version=2.5.0.0
    2019-09-10 11:37:39,936       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-activity-id: xxx
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-request-charge: 0
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.headers - http-outgoing-1 << Strict-Transport-Security: max-age=31536000
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.headers - http-outgoing-1 << x-ms-gatewayversion: version=2.5.1
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.headers - http-outgoing-1 << Date: Tue, 10 Sep 2019 02:37:39 GMT
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive indefinitely
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - Authentication required
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - {myhost}-japaneast.documents.azure.com:443 requested authentication
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - Response contains no authentication challenges
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "0[\r][\n]"
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.wire - http-outgoing-1 << "[\r][\n]"
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 1][route: {s}->https://{myhost}-japaneast.documents.azure.com:443] can be kept alive indefinitely
    2019-09-10 11:37:39,937       [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 1][route: {s}->https://{myhost}-japaneast.documents.azure.com:443][total kept alive: 2; route allocated: 1 of 800; total allocated: 2 of 800]
    Exception in thread "main" java.lang.IllegalStateException: com.microsoft.azure.documentdb.DocumentClientException: Message: {"Errors":["Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications.","Date header doesn't conform to the required format. Please ensure that the time is provided in GMT and conforms to RFC 1123 date-time specifications."]}
    ActivityId: xxx, Request URI: /apps/xxx, RequestStats: 



    Tuesday, September 10, 2019 4:19 AM
  • Hi Yokohairi,

    Can you verify the version of the Cosmos DB Java SDK you are seeing this error as this has been fixed in the latest version of the Java SDK:

        // NOTE DateTimeFormatter.RFC_1123_DATE_TIME cannot be used.
        // because cosmos db rfc1123 validation requires two digits for day.
        // so Thu, 04 Jan 2018 00:30:37 GMT is accepted by the cosmos db service,
        // but Thu, 4 Jan 2018 00:30:37 GMT is not.
        // Therefore, we need a custom date time formatter.
        private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
    

    The issue being two digits for the day of the month being correct. 

    // Incorrect Date format 
                    "headers": {
                                    "Accept": "application/json",​
                                    "x-ms-date": "Fri, 9 Aug 2019 00:00:00 GMT",​
    
    // Correct Date format 
                    "headers": {
                                    "Accept": "application/json",​
                                    "x-ms-date": "Fri, 09 Aug 2019 00:00:00 GMT",​

    This will address your issue.

    Regards,

    Mike

    Wednesday, September 11, 2019 10:34 PM
    Moderator
  • Hi, Thank you for your response!

    I confirmed Latest AsyncDocumentClient works well.

    But I want to use com.microsoft.azure.documentdb.DocumentClient, what should I use class?
    Is this class dropped in latest SDK?

     Some example code use azure-documentdb class yet. 

    https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-java-samples

    Regards,

    <style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo} </style><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo} </style>

    Thursday, September 12, 2019 5:14 AM
  • In my environment, problem was fixed by updating pom.xml

    1. I inserted Latest joda-time at first of pom.xml

    <dependency>

    <groupId>joda-time</groupId>

    <artifactId>joda-time</artifactId>

    <version>LATEST</version>

    </dependency>

    -> joda-time-2.10.3.jar was listed in Maven Dependencies

    And ran same App again.

    ...

    2019-09-12 15:37:23,477       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> GET / HTTP/1.1
    ...
    2019-09-12 15:37:23,477       [main] DEBUG org.apache.http.headers - http-outgoing-0 >> x-ms-date: Thu, 12 Sep 2019 06:37:23 GMT
    ...
    2019-09-12 15:37:23,502       [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Thu, 12 Sep 2019 06:37:22 GMT[\r][\n]"

    -> x-ms-date was fixed from +00:00 to GMT

    Thank you.




    Thursday, September 12, 2019 6:56 AM
  • Thank you for providing this update, Yokohairi. I am going to propose your reply as the answer as this will be helpful to others experiencing the same issue. 

    Regards,

    Mike

    Thursday, September 12, 2019 6:26 PM
    Moderator