Skip to content

create_function returns "InvalidParameterValueException" #2

Description

@chaelir

These are OK .

> list_functions()
list()
> hello <- system.file("templates", "helloworld.js", package = "aws.lambda")
> requireNamespace("aws.iam")
> id <- aws.iam::get_caller_identity()[["Account"]]
> role <- paste0("arn:aws:iam::", id, ":role/lambda_basic_execution")
> id
[1] "429492368957"
> role
[1] "arn:aws:iam::429492368957:role/lambda_basic_execution"

Until ...

> **func <- create_function(name = "helloworld", func = hello, 
+                           handler = "helloworld.handler", role = role)**
  adding: helloworld.js (deflated 8%)
$url
[1] "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions"

$status_code
[1] 400

$headers
$`content-type`
[1] "application/json"

$date
[1] "Thu, 24 Aug 2017 21:19:52 GMT"

$`x-amzn-errortype`
[1] "InvalidParameterValueException"

$`x-amzn-requestid`
[1] "f8291245-8911-11e7-a3f2-dbe51e4b1bcf"

$`content-length`
[1] "90"

$connection
[1] "keep-alive"

attr(,"class")
[1] "insensitive" "list"       

$all_headers
$all_headers[[1]]
$all_headers[[1]]$status
[1] 400

$all_headers[[1]]$version
[1] "HTTP/1.1"

$all_headers[[1]]$headers
$`content-type`
[1] "application/json"

$date
[1] "Thu, 24 Aug 2017 21:19:52 GMT"

$`x-amzn-errortype`
[1] "InvalidParameterValueException"

$`x-amzn-requestid`
[1] "f8291245-8911-11e7-a3f2-dbe51e4b1bcf"

$`content-length`
[1] "90"

$connection
[1] "keep-alive"

attr(,"class")
[1] "insensitive" "list"       



$cookies
[1] domain     flag       path       secure     expiration name       value     
<0 rows> (or 0-length row.names)

$content
$content$Type
[1] "User"

$content$message
[1] "The role defined for the function cannot be assumed by Lambda."


$date
[1] "2017-08-24 21:19:52 GMT"

$times
     redirect    namelookup       connect   pretransfer starttransfer         total 
     0.000000      0.000076      0.000079      0.000341      0.106718      0.106756 

$request
<request>
POST https://lambda.us-east-1.amazonaws.com/2015-03-31/functions
Output: write_memory
Options:
* useragent: libcurl/7.54.0 r-curl/2.8.1 httr/1.3.1
* post: TRUE
* postfieldsize: 471
* postfields: as.raw(c(0x7b, 0x22, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x3a, 0x7b, 0x22, 0x5a, 0x69, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x3a, 0x22, 0x55, 0x45, 0x73, 0x44, 0x42, 0x42, 0x51, 0x41, 0x41, 0x67, 0x41, 0x49, 0x41, 0x44, 0x4e, 0x79, 0x47, 0x45, 0x76, 0x4d, 0x4e, 0x47, 0x54, 0x49, 0x55, 0x77, 0x41, 0x41, 0x41, 0x46, 0x6f, 0x41, 0x41, 0x41, 0x41, 0x4e, 0x41, 0x41, 0x41, 0x41, 0x61, 0x47, 0x56, 0x73, 0x62, 0x47, 0x39, 0x33, 0x62, 0x33, 0x4a, 0x73, 0x5a, 0x43, 0x35, 0x71, 0x63, 0x30, 0x75, 0x74, 0x4b, 0x4d, 
0x67, 0x76, 0x4b, 0x69, 0x6e, 0x57, 0x79, 0x30, 0x6a, 0x4d, 0x53, 0x38, 0x6c, 0x4a, 0x4c, 0x56, 0x4b, 0x77, 0x56, 0x55, 0x67, 0x72, 0x7a, 0x55, 0x73, 0x75, 0x79, 0x63, 0x7a, 0x50, 0x55, 0x39, 0x42, 0x49, 0x4c, 0x55, 0x76, 0x4e, 0x4b, 0x39, 0x46, 0x52, 0x53, 0x4d, 0x37, 0x50, 0x4b, 0x30, 0x6d, 0x74, 0x4b, 0x4e, 0x46, 0x55, 0x71, 0x4f, 0x62, 0x6c, 0x55, 0x67, 0x41, 0x43, 0x4b, 0x46, 0x2b, 0x76, 0x75, 0x44, 0x51, 0x35, 0x4f, 0x54, 0x55, 0x31, 0x52, 0x55, 0x50, 0x64, 0x49, 0x7a, 0x55, 0x6e, 0x4a, 0x31, 
0x39, 0x48, 0x6f, 0x54, 0x79, 0x2f, 0x4b, 0x43, 0x64, 0x46, 0x55, 0x56, 0x33, 0x54, 0x6d, 0x70, 0x65, 0x72, 0x46, 0x6f, 0x67, 0x42, 0x55, 0x45, 0x73, 0x42, 0x41, 0x68, 0x34, 0x44, 0x46, 0x41, 0x41, 0x43, 0x41, 0x41, 0x67, 0x41, 0x4d, 0x33, 0x49, 0x59, 0x53, 0x38, 0x77, 0x30, 0x5a, 0x4d, 0x68, 0x54, 0x41, 0x41, 0x41, 0x41, 0x57, 0x67, 0x41, 0x41, 0x41, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x4b, 0x53, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x47, 
0x68, 0x6c, 0x62, 0x47, 0x78, 0x76, 0x64, 0x32, 0x39, 0x79, 0x62, 0x47, 0x51, 0x75, 0x61, 0x6e, 0x4e, 0x51, 0x53, 0x77, 0x55, 0x47, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x51, 0x41, 0x37, 0x41, 0x41, 0x41, 0x41, 0x66, 0x67, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x22, 0x7d, 0x2c, 0x22, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x22, 0x2c, 0x22, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x22, 0x2c, 0x22, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x3a, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x2c, 0x22, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x3a, 0x22, 0x61, 0x72, 0x6e, 0x3a, 0x61, 0x77, 0x73, 0x3a, 0x69, 0x61, 0x6d, 0x3a, 0x3a, 0x34, 0x32, 0x39, 0x34, 0x39, 0x32, 0x33, 0x36, 0x38, 0x39, 0x35, 0x37, 
0x3a, 0x72, 0x6f, 0x6c, 0x65, 0x2f, 0x6c, 0x61, 0x6d, 0x62, 0x64, 0x61, 0x5f, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2c, 0x22, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x6e, 0x6f, 0x64, 0x65, 0x6a, 0x73, 0x36, 0x2e, 0x31, 0x30, 0x22, 0x7d))
Headers:
* Accept: application/json, text/xml, application/xml, */*
* Content-Type: 
* host: lambda.us-east-1.amazonaws.com
* x-amz-date: 20170824T211737Z
* x-amz-content-sha256: 138800f21abd7f296fc7e6829855336aa479a28567299ad710580d0aa6a5121c
* Authorization: AWS4-HMAC-SHA256 Credential=AKIAJY37HJUB2BLHZ3ZA/20170824/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=23e1de83c9d4690f5f9bdd600f7033c26f6da672634c276d3ce0b568f0294d0f

$handle
<curl handle> (empty)

attr(,"class")
[1] "aws_error"
attr(,"headers")
$`content-type`
[1] "application/json"

$date
[1] "Thu, 24 Aug 2017 21:19:52 GMT"

$`x-amzn-errortype`
[1] "InvalidParameterValueException"

$`x-amzn-requestid`
[1] "f8291245-8911-11e7-a3f2-dbe51e4b1bcf"

$`content-length`
[1] "90"

$connection
[1] "keep-alive"

attr(,"class")
[1] "insensitive" "list"       
attr(,"request_canonical")
[1] "POST\n/2015-03-31/functions\n\nhost:lambda.us-east-1.amazonaws.com\nx-amz-date:20170824T211737Z\n\nhost;x-amz-date\n138800f21abd7f296fc7e6829855336aa479a28567299ad710580d0aa6a5121c"
attr(,"request_string_to_sign")
[1] "AWS4-HMAC-SHA256\n20170824T211737Z\n20170824/us-east-1/lambda/aws4_request\n24203a375dcd7b119ef2520e2c48e5dfb74c10d5d92fed6d60afd205a2370125"
attr(,"request_signature")
[1] "AWS4-HMAC-SHA256 Credential=AKIAJY37HJUB2BLHZ3ZA/20170824/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=23e1de83c9d4690f5f9bdd600f7033c26f6da672634c276d3ce0b568f0294d0f"
Error in lambdaHTTP(verb = "POST", action = act, body = b, ...) : 
  Bad Request (HTTP 400).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions