Comments (12)
After a bit of debugging and getting the content of XML of the GET call, it says The Date header in the request is incorrect.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<?xml version="1.0" encoding="utf-8"?><html><body><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:b8c84964-0001-00c2-6fcd-bd0f86000000
Time:2017-04-25T14:09:27.9794599Z</message><authenticationerrordetail>The Date header in the request is incorrect.</authenticationerrordetail></error></body></html>
The header looks like this in R
Authorization
"LEFT OUT FOR CONFIDENTIALITY"
Content-Length
"0"
x-ms-version
"2015-04-05"
x-ms-date
"di, 25 apr 2017 14:09:59 GMT"
My locale settings (which are used in the call) are:
Sys.getlocale("LC_TIME")
[1] "Dutch_Netherlands.1252"
from azuresmr.
Hi,
We did have a few similar issues earlier in the year. Have you recently update the package?
Many thanks
Alan
from azuresmr.
I installed today with devtools::install_github("Microsoft/AzureSMR")
.
What is the solution to this error?
from azuresmr.
Originally there was no need to get the Key as it would get the key during the function automatically.
e.g-
sc <- createAzureContext(tenantID = "{TID}", clientID = "{CID}", authKey= "{KEY}")
azureListStorageContainers(sc, storageAccount = "bnosacdata4training")
There was some work to change this so a key could be provided. That way the user wouldn't need admin access. (which you need to get the key).
Do any of the other blob functions work or is this just azureListStorageContainers()
?
from azuresmr.
The proposed solution does not work. This is what I get.
> azureListStorageContainers(sc, storageAccount = "bnosacdata4training")
Error in azureListStorageContainers(sc, storageAccount = "bnosacdata4training") :
Error: No resourceGroup provided: Use resourceGroup argument or set in AzureContext
> azureListStorageContainers(sc, resourceGroup = "bnosac-training", storageAccount = "bnosacdata4training")
Fetching Storage Key..
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
Error: azureListStorageContainers()
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:173a23ff-0001-00ec-21de-bd8f41000000
Time:2017-04-25T16:14:03.2643166Z
Return code: 403
from azuresmr.
That looks like a locale problem. The Azure storage REST API constructs "canonical headers" as follows (reference):
x-ms-date:Sat, 21 Feb 2015 00:48:38 GMT\nx-ms-version:2014-02-14\n
So, if you're using a different locale, this is a bug in the package - we should transcode the locale.
As a workaround, can you try using an English locale?
On my test machine I get:
> Sys.getlocale()
[1] "LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252"
from azuresmr.
@andrie Thanks for the feedback.
Changing the locale did the trick. The following worked for me.
Sys.setlocale(category = "LC_TIME", locale = "English_United Kingdom.1252")
azureListStorageContainers(sc, resourceGroup = "bnosac-training", storageAccount = "bnosacdata4training")
from azuresmr.
@jwijffels Thanks for confirming. I have now marked this as a bug.
from azuresmr.
@jwijffels Can you please test again using the latest version (v0.2.4)?
I think this has now been fixed.
from azuresmr.
Looks fine for the error I reported about azureListStorageContainers
I'm trying out the next part - uploading blobs.
When I serialise as JSON and put the data as blob, this is working fine.
> l <- lm(Sepal.Width ~ Sepal.Length, data = iris)
> save(l, file = "test.RData")
> x <- jsonlite::serializeJSON(l)
> azurePutBlob(sc, storageAccount = "bnosacdata4training", container = "opendata",
+ contents = x, blob = "HELLO")
blob HELLO saved: 17293 bytes written
[1] TRUE
> azureDeleteBlob(sc, storageAccount = "bnosacdata4training", container = "opendata", blob = "HELLO")
Blob delete request accepted
[1] TRUE
When I use the file argument, I get a similar authentication signature error. I don't know if this is the type of error, or if I'm using the function incorrectly.
> azurePutBlob(sc, storageAccount = "bnosacdata4training", container = "opendata",
+ file = file.path(getwd(), "test.RData"), blob = "HELLO")
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
Error: azurePutBlob()
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:c0cf2754-0001-0034-4bf7-de2890000000 Time:2017-06-06T19:03:58.1503340Z
The MAC signature found in the HTTP request '6u27LKSnNfLe5mSaQ2pKq0YaHOt7WcPAzVwk5bpW2IU=' is not the same as any computed
signature. Server used following string to sign: 'PUT
text/plain; charset=UTF-8
x-ms-blob-type:Blockblob x-ms-date:Tue, 06 Jun 2017 19:05:34 GMT x-ms-version:2015-04-05 /bnosacdata4training/opendata/HELLO'.
Return code: 403
This also does not work as I was expecting it to work
> x <- iris
> azurePutBlob(sc, storageAccount = "bnosacdata4training", container = "opendata",
+ contents = x, blob = "HELLO")
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
Error: azurePutBlob()
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:b7f3bf41-0001-00d4-3afa-dece18000000 Time:2017-06-06T19:27:09.4361225Z
The MAC signature found in the HTTP request 'JOFm8CP/U38FR1sY9wB8UzlIKK+HYrUS9SGqkaxNgk4=' is not the same as any computed
signature. Server used following string to sign: 'PUT
562
text/plain; charset=UTF-8; boundary=------------------------651f1103ec6bf4be
x-ms-blob-type:Blockblob x-ms-date:Tue, 06 Jun 2017 19:28:45 GMT x-ms-version:2015-04-05 /bnosacdata4training/opendata/HELLO'.
Return code: 403
In addition: Warning messages:
1: In charToRaw(object) :
argument should be a character vector of length 1
all but the first element will be ignored
2: In charToRaw(enc2utf8(val)) :
argument should be a character vector of length 1
all but the first element will be ignored
3: In charToRaw(enc2utf8(val)) :
argument should be a character vector of length 1
all but the first element will be ignored
4: In charToRaw(enc2utf8(val)) :
argument should be a character vector of length 1
all but the first element will be ignored
5: In charToRaw(enc2utf8(val)) :
argument should be a character vector of length 1
all but the first element will be ignored
6: In charToRaw(enc2utf8(val)) :
argument should be a character vector of length 1
all but the first element will be ignored
from azuresmr.
I get the same error as in the previous comment.
from azuresmr.
My workaround for an image file was simply to send it raw via the contents
argument: magick::image_read(file) %>% magick::image_write()
from azuresmr.
Related Issues (20)
- Undefined index_resource in azureDataConsumption()
- install_github failing HOT 1
- Issue authenticating with tutorial HOT 5
- Can't read/write to blob storage HOT 2
- azureCreateStorageAccount fails while storage account does not exist HOT 1
- license HOT 1
- Extracting an excel file with multiple tabs from Azure to R HOT 1
- Read .gz file from Data Lake HOT 1
- R 3.5 Support
- download more than 5000 blobs HOT 1
- Writing dataframe to blob with AzurePutbBlob HOT 5
- Error trying to write to Blob
- azureDataLake functions don't work HOT 2
- AzurePutBlob should take contenttype as an argument
- DeviceCode authentication doesn't work HOT 2
- resourceGroup should be optional when providing a storage key
- Use HTTPS when communicating with Storage API
- Storing raw objects does not work due to invalid authorisation signature HOT 1
- Support ADLS as alternative to storage account in HDI HOT 1
- Authentication Rmd outdated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azuresmr.