TaskscheduleR job returns fetch.write_memory error but works as a local job in RStudio on a virtual machine

446 Views Asked by At

I'm trying to set up an automated job that builds an csv file (by pulling aggregates from multiple MySQL databases) and sends an email out on a daily schedule. The entire script works as a local job (via RStudio jobs v1.2.1335) if the script is run through RStudio normally. However, when the job is automated through taskscheduleR addin, it returns the following error:

Error in curl::curl_fetch_memory(url, handle = handle) : 
  Could not resolve host: .domo.com
Calls: <Anonymous> ... request_fetch -> request_fetch.write_memory -> <Anonymous>
Execution halted

My guess is that my DomoR package is masking the fetch function multiple times:

Welcome to DomoR

Attaching package: 'DomoR'

The following object is masked from 'package:RMySQL':

    fetch

The following object is masked from 'package:DBI':

    fetch

But I'm not entirely sure if that is the issue. I am running this through an aws EC2 instance running Microsoft Server 2019.

1

There are 1 best solutions below

0
On BEST ANSWER

I found out that my username and password was not being used in the automated job. It seems that your .Renviron file will not be pulled properly in a EC2 automated job.

You can solve this problem by getting your .Renviron and loading it in as a dataframe. Then calling in the credentials.