salesforce-marketingcloud / FuelSDK-Node

BSD 3-Clause "New" or "Revised" License
49 stars 24 forks source link

sfmc-fuelsdk-node/.cache #27

Closed robbdempsey closed 5 years ago

robbdempsey commented 5 years ago

I'm trying to use your library to fire off triggeredSends. Everything works fine locally in my testing, but once I deploy to a lambda on AWS I get the error below. Is there a way to disable the cache?

installed: "sfmc-fuelsdk-node": "^2.3.0" lambda: node 10.x

function

async function triggerSend(messageType, Subscribers) {
  const triggerKey = TriggerKeys[messageType.toLowerCase()]
  const payload = {
    props: {
      TriggeredSendDefinition: {
        CustomerKey: triggerKey
      },
      Subscribers
    }
  }

  return new Promise((resolve, reject) => {
    const triggeredSend = client.triggeredSend(payload)

    triggeredSend.send(function(err, response) {
      if (err) {
        const {results} = err
        return reject(results[0] || {})
      }
      const {body} = response

      resolve(body)
    })
  })
}

error

2019-05-22T22:11:50.334Z    8960fe66-0163-4cb8-95b4-052160a17ffb    ERROR   (node:7) UnhandledPromiseRejectionWarning: Error: EROFS: read-only file system, open '/var/task/node_modules/sfmc-fuelsdk-node/.cache'
robbdempsey commented 5 years ago

I found a work around for this issue, which is a bit of a hack. Once I've passed the deadline on this bit of work I may come back around with a proposed lambda solution.

https://hackernoon.com/writing-a-self-sufficient-aws-lambda-function-da6c0586f48c