Skip to content

put_object error: Argument object must be of type character or raw vector #425

@msmith1695

Description

@msmith1695

Encountering an error while using the put_object function while attempting a basic CSV file upload to S3 via R, using the aws.s3 package. Code:

library(aws.s3)
library(tcltk)

Sys.setenv(
  "AWS_ACCESS_KEY_ID" = "xxxxxxxxxxxxxxxxxxxx",
  "AWS_SECRET_ACCESS_KEY" = "xxxxxxxxxxxxxxxxxxxx",
  "AWS_DEFAULT_REGION" = "us-east-1"
)

file_to_upload <- read.csv(tk_choose.files(caption = "Choose CSV file to upload"))

put_object(file = file_to_upload,
           object = "test.csv",
           bucket = "bucket_name",
           folder = "folder_name",
           )

Which results in an error message of:

Error: Argument object must be of type character or raw vector if serialize is FALSE

With the verbose = TRUE parameter included in the function call, output is:

Locating credentials
Checking for credentials in user-supplied values
Checking for credentials in Environment Variables
Using Environment Variable 'AWS_ACCESS_KEY_ID' for AWS Access Key ID
Using Environment Variable 'AWS_SECRET_ACCESS_KEY' for AWS Secret Access Key
Using Environment Variable 'AWS_DEFAULT_REGION' for AWS Region ('us-east-1')
S3 Request URL: https://s3.amazonaws.com/bucket_name/folder_name/test.csv
Executing request with AWS credentials
Locating credentials
Checking for credentials in user-supplied values
Using user-supplied value for AWS Access Key ID
Using user-supplied value for AWS Secret Access Key
Using user-supplied value for AWS Region ('us-east-1')
Error: Argument object must be of type character or raw vector if serialize is FALSE

This seems closely related to Issue #243.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions