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.

Authorization problem when including a library

See original GitHub issue

@azure/storage-blob - 12.2.0-preview.1 Operating system : Debian nodejs : v12.16.1

Hi, I am facing a problem with azure storage authorization. It works well if I don’t include a particular library https://github.com/pagarme/pagarme-js If and only if I include the library above in the files I get the following error :

azure:core-http:info ServiceClient: using custom request policies
azure:storage-blob:info RetryPolicy: =====> Try=1 Primary
azure:storage-blob:info Request: {
  "streamResponseBody": false,
  "url": "https://versatyou.blob.core.windows.net/closet?restype=container",
  "method": "GET",
  "headers": {
    "_headersMap": {
      "x-ms-version": "2019-12-12",
      "user-agent": "azsdk-js-storageblob/12.2.0-preview.1 (NODE-VERSION v12.16.1; Linux 4.19.0-6-amd64)",
      "x-ms-client-request-id": "5638202a-9f54-4364-8c58-c5bb37b306d8"
    }
  },
  "withCredentials": false,
  "timeout": 0,
  "keepAlive": true,
  "requestId": "5638202a-9f54-4364-8c58-c5bb37b306d8"
}
azure:storage-blob:info Response status code: 200
azure:storage-blob:info Headers: {
  "_headersMap": {
    "content-length": "0",
    "last-modified": "Tue, 21 Apr 2020 03:38:19 GMT",
    "etag": "\"0x8D7E5A56F3C61E3\"",
    "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
    "x-ms-request-id": "c65f3bee-401e-0063-1587-71d2b4000000",
    "x-ms-client-request-id": "5638202a-9f54-4364-8c58-c5bb37b306d8",
    "x-ms-version": "2019-12-12",
    "x-ms-lease-status": "unlocked",
    "x-ms-lease-state": "available",
    "x-ms-has-immutability-policy": "false",
    "x-ms-has-legal-hold": "false",
    "x-ms-blob-public-access": "blob",
    "x-ms-default-encryption-scope": "$account-encryption-key",
    "x-ms-deny-encryption-scope-override": "false",
    "date": "Thu, 13 Aug 2020 15:36:41 GMT"
  }
}
azure:core-http:info ServiceClient: using custom request policies
azure:storage-blob:info RetryPolicy: =====> Try=1 Primary
azure:storage-blob:info Request: {
  "streamResponseBody": false,
  "url": "https://versatyou.blob.core.windows.net/closet/372-1597333001317.jpg",
  "method": "PUT",
  "headers": {
    "_headersMap": {
      "content-type": "application/octet-stream",
      "content-length": "47953",
      "x-ms-version": "2019-12-12",
      "x-ms-blob-type": "BlockBlob",
      "user-agent": "azsdk-js-storageblob/12.2.0-preview.1 (NODE-VERSION v12.16.1; Linux 4.19.0-6-amd64)",
      "x-ms-client-request-id": "844fb675-976f-4f45-a280-272c6429cc19"
    }
  },
  "withCredentials": false,
  "timeout": 0,
  "keepAlive": true,
  "requestId": "844fb675-976f-4f45-a280-272c6429cc19"
}
azure:storage-blob:info Response status code: 403
azure:storage-blob:info Headers: {
  "_headersMap": {
    "content-length": "777",
    "content-type": "application/xml",
    "server": "Microsoft-HTTPAPI/2.0",
    "x-ms-request-id": "c65f3c3e-401e-0063-5f87-71d2b4000000",
    "x-ms-error-code": "AuthenticationFailed",
    "date": "Thu, 13 Aug 2020 15:36:41 GMT"
  }
}
RestError: <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:c65f3c3e-401e-0063-5f87-71d2b4000000
Time:2020-08-13T15:36:41.9145879Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '/GQQJkZV5RJOrZsHeCXDRhomWgDQEvS74tBkEa8BPSU=' is not the same as any computed signature. Server used following string to sign: 'PUT




application/octet-stream






x-ms-blob-type:BlockBlob
x-ms-date:Thu, 13 Aug 2020 15:36:41 GMT
x-ms-version:2019-12-12
/versatyou/closet/372-1597333001317.jpg'.</AuthenticationErrorDetail></Error> 
 {
  "name": "RestError",
  "statusCode": 403,
  "request": {
    "streamResponseBody": false,
    "url": "https://versatyou.blob.core.windows.net/closet/372-1597333001317.jpg",
    "method": "PUT",
    "headers": {
      "_headersMap": {
        "content-type": "application/octet-stream",
        "x-ms-version": "REDACTED",
        "x-ms-blob-type": "REDACTED",
        "user-agent": "azsdk-js-storageblob/12.2.0-preview.1 (NODE-VERSION v12.16.1; Linux 4.19.0-6-amd64)",
        "x-ms-date": "REDACTED",
        "authorization": "REDACTED",
        "cookie": "REDACTED"
      }
    },
    "withCredentials": false,
    "timeout": 0,
    "keepAlive": true,
    "decompressResponse": false,
    "requestId": "844fb675-976f-4f45-a280-272c6429cc19"
  },
  "details": {
    "date": "2020-08-13T15:36:41.000Z",
    "errorCode": "AuthenticationFailed",
    "content-length": "777",
    "content-type": "application/xml",
    "server": "Microsoft-HTTPAPI/2.0",
    "message": "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:c65f3c3e-401e-0063-5f87-71d2b4000000\nTime:2020-08-13T15:36:41.9145879Z",
    "Code": "AuthenticationFailed",
    "AuthenticationErrorDetail": "The MAC signature found in the HTTP request '/GQQJkZV5RJOrZsHeCXDRhomWgDQEvS74tBkEa8BPSU=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\napplication/octet-stream\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-client-request-id:844fb675-976f-4f45-a280-272c6429cc19\nx-ms-date:Thu, 13 Aug 2020 15:36:41 GMT\nx-ms-version:2019-12-12\n/versatyou/closet/372-1597333001317.jpg'."
  },
  "message": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:c65f3c3e-401e-0063-5f87-71d2b4000000\nTime:2020-08-13T15:36:41.9145879Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '/GQQJkZV5RJOrZsHeCXDRhomWgDQEvS74tBkEa8BPSU=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\napplication/octet-stream\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-client-request-id:844fb675-976f-4f45-a280-272c6429cc19\nx-ms-date:Thu, 13 Aug 2020 15:36:41 GMT\nx-ms-version:2019-12-12\n/versatyou/closet/372-1597333001317.jpg'.</AuthenticationErrorDetail></Error>"
}

I just have to include the library using require in my files, and stop working! That behavior is weird. Javascript is supposed to be a memory-safe language, so adding a new library won’t change anything.

I need to know is there some internal problems that might cause this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jiacfancommented, Aug 31, 2020

Good to know the workaround works.

Thanks, Jiachen

1reaction
caotic123commented, Aug 30, 2020

I built the lastest code in the master branch, however, I still getting conflicts with the header. As a workaround, I just moved the import to some local context like :

  function then() {
   import {} from conflict_library;
   ....
}

Well, now it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Library Authentication Problems
First, try logging into another WebAccess authenticated resource, like Canvas or My Library Account, then try the database link again; If you're still...
Read more >
Troubleshooting problems with APF-authorization - IBM
If a library concatenation includes a non-authorized library, (for example, you have not authorized your COBOL compiler library), then no library in that ......
Read more >
Authorization Library or Service - Aserto
Being isolated from the application, an authorization service has to be able resolve the information it needs to make a decision, which makes...
Read more >
Why Authorization is Hard - Oso
Library solutions typically use a tighter integration with specific frameworks to offer more functionality. Authorization services and policy ...
Read more >
If iTunes for Windows prompts you to authorize your computer ...
Try authorizing your purchases with a different Apple ID · On your PC, open iTunes for Windows. · In Library, find a song...
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