Giter Club home page Giter Club logo

fuelsdk-node's People

Contributors

amagar088 avatar manivinesh avatar rhrituc avatar sf-csarov avatar sfdrogojan avatar svc-scm avatar timsim00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuelsdk-node's Issues

sfmc-fuelsdk-node/.cache

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'

Connection exceptions after upgrade

We run AWS Lambda function which uses FuelSDK to update a Data Extension. We recently upgraded the SDK from 1.1.8 to 2.1.0. After the upgrade the lambda function started crashing with following errors

START RequestId: 7adcc610-33b7-4c1d-9ebe-38ad8957525e Version: 37
2016-12-03T04:56:14.799Z	4722357d-fda6-49d0-87df-28538e923b27	Error: connect ECONNRESET 198.245.89.89:443
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)
END RequestId: 7adcc610-33b7-4c1d-9ebe-38ad8957525e
REPORT RequestId: 7adcc610-33b7-4c1d-9ebe-38ad8957525e	Duration: 35.29 ms	Billed Duration: 100 ms Memory Size: 256 MB	Max Memory Used: 49 MB	
Process exited before completing request

Also

START RequestId: 30200f4c-20df-49e7-9876-b18635d7dd94 Version: 37
2016-12-03T04:56:59.816Z	396a31ac-1671-46ad-818f-61f9b8597cc3	Error: socket hang up
at createHangUpError (_http_client.js:200:15)
at TLSSocket.socketOnEnd (_http_client.js:285:23)
at emitNone (events.js:72:20)
at TLSSocket.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:437:9)
at process._tickDomainCallback (node.js:392:17)
END RequestId: 30200f4c-20df-49e7-9876-b18635d7dd94
REPORT RequestId: 30200f4c-20df-49e7-9876-b18635d7dd94	Duration: 34.86 ms	Billed Duration: 100 ms Memory Size: 256 MB	Max Memory Used: 52 MB	
Process exited before completing request

These errors seem to mostly happen during slow traffic hours and before the error there has been 1-2 minutes of idle time. My hypothesis is the Exact Target server side has closed the socket and because that is not handled, it causes an exception which kills the process.

Has something changed in the SDK because this problem started happening after the SDK upgrade?

According to the logs, the exception occurs before any of our code runs in the lambda function, making it impossible to put a try+catch around it. Would it be possible to either:

  • handle the error in the SDK or
  • emit the error as an event from the SDK to allow the application to handle the error

Save multiple subscribers in one request

Hello!

Is it possible to save multiple subscribers in one request?
I'm trying to put subscribers in a specific list.

I can send only one subscriber to SFMC using the code like below:

const SFMC = require('sfmc-fuelsdk-node')
const client = new SFMC(credentials.clientId, credentials.clientSecret)
  client.subscriber({
    props: { // ....

But unfortunately, I can't see how it's possible to send multiple subscribers.
Is there a way to do it? Maybe I can use client.SoapClient or something else?
Could you, please, help me to find a solution?

Or if there is no way to do it, it can be implemented in a new version.

Thank you.

Proxy support for all requests

Hi!
Right now, i cant see, how to use this sdk, when i am sitting behind the firewall.
It will be nice, to have possibility to specify { proxy : 'url' } for requests.

[Enhancement] Related to documentation

It keeps returning "The stack is deprecated. Will be removed on future release. Please use authOrigin property instead." . It would be very nice if you could be extra clear on where to find the Origin, AuthOrigin, and SoapOrigin. and When I actually pass those values, it times out. So I must've passed the wrong value.

Error in postDERow.

I have given my definition as

var options = {
Name: "PUSH Message Detail Report DE",
props: {
"Subscriberkey": "[email protected]",
"ClientId": "134444"
}
};

However, I am getting "soap error" as response of post. I am using "fuelsdk-node": "2.1.0".

Would you have any insight into why this error is coming.

Thanks,
Vineet
[email protected]

[BUG] Calling client.dataExtensionRow() gives the error of ERR_INVALID_ARG_TYPE and crashes the node app.

Describe the bug
Calling client.dataExtensionRow() gives the error of ERR_INVALID_ARG_TYPE and crashes the node app.

Expected behaviour
Get a List of records from Data Extension based on passed props.

{ Name: 'Email', Value: '[email protected]' }

Code snippet

const ET_Client = require('sfmc-fuelsdk-node');
//....

function getDERecords(){

const client = new ET_Client(clientId, clientSecret);
  const deRow = client.dataExtensionRow({
    Name: 'CustomActivityDataExt',
    props: ['Email'],
  });

  deRow.get((err, res) => {
    if (err) {
      console.error(err.message);
    } else {
      console.log(res.body.Results);
    }
  });
}

Screenshots

Screenshot 2023-07-11 at 3 06 51 PM

Environment

  • SDK Version: 2.4.0
  • Node version: 16.16.0

The bug has the severity

  • Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

postDERow

I found this issue, it is why I initially opened this issue but it is with the backbone app not the SDK.

var options = {
    Name: "SDKDataExtension",
    props: {
        "Key": "ThisIsTheKey",
        "Value": "Some random text for the value field"
    }
};

The options should actually look like this:

var options = {
    Name: "SDKDataExtension",
    props: {
        "Key": "Value",
        "Key": "Value",
        "Key": "Value"
    }
};

routes/de-routes.js - Line 182 - backbone-app.

[Enhancement] Support for Node 14

Is your feature request related to a problem? Please describe
The lib doesn't support Node 14.
When calling client.dataExtensionRow(...).get(...), the fs library returns an error: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object.
This is the faulty line:

// CacheService.js
_getOrCreateFile() {
    ...
    return this._writeFile({flag: 'wx'}).then(...)
}

Describe the solution you'd like
Update the lib to support Node 14.

Describe alternatives you've considered
Changing the _writeFile method to something like this: _writeFile("wx") works fine!
That's because newer version of fs expects a string for file content.

Additional context
Add any other context or screenshots about the feature request here.

NPM Package

Please make an npm package out of this. All the dependencies (fuel-rest and fuel-soap) are already in a package...

Add typescript support

Is your feature request related to a problem? Please describe
I'm trying to use this project in my typescript project and I'm having to build the typescript functionality I need.

Describe the solution you'd like
Either update the project to add support or add an ancillary project that provides @types/sfmc-fuelsdk-node

Describe alternatives you've considered
I've tried to build this myself for my needs but I don't know the code that well, nor do I know node all that well to do it correctly.

Additional context
I started doing this and it's in the very early stages. Would be nice if this was done by someone that knows the code.
image

Not able to perform dataExtension.get(cb);

Hello there,
Before I inform anything I want to show how I instantiate the SDK in my code

const ET_Client = require('sfmc-fuelsdk-node');
const IET_Client = new ET_Client(clientId, clientSecret, stack, {
origin: originURL, //String
soapOrigin: soapURL, //String
authOrigin: authURL, //String
authOptions: {
authVersion: authVersion, //String
accountId: MID, //String
applicatioType: 'server'
}
});

I tried to use this function to get the data extension from my MC
Before this 2 3 months Its work fine nothing to worries but, now I tried to connect my custom app
with the new MC Business Unit, I got an error of 'unsupported_grant_type'

var dataExtension = IET_Client.dataExtension(options);
dataExtension.get(function(err, response) {
console.log(err);
}

err :
{
"res":
{
"error":"unsupported_grant_type",
"error_description":"Use "authorization_code" or "refresh_token" or "client_credentials" or "urn:ietf:params:oauth:grant-type:jwt-bearer" as the grant_type.",
"error_uri":"https://developer.salesforce.com/docs"
}
}

I got this data when I try to use dataExtension.get(cb); I'm not so sure what am I do wrong in this process

Expected behavior
I want this function to return the data of the data extension I mean the list of data extension from my business Unit

Environment

  • SDK Version 2.4.0
  • Node version 10.16.3

The bug has the severity

  • Critical: The defect affects critical functionality or critical data. It does not have a workaround.

Error with legacy /v1/requestToken endpoint

I have beam provided with new set of ClientId ClientSecret and when using them, I am getting error:
Error: No access token�[0m
Stack:
error properties: Object({ res: Object({ message: 'This integration is not eligible to use the legacy /v1/requestToken endpoint because the integration uses enhanced OAuth 2.0 functionality. To obtain a token for this integration, use the applicable Marketing Cloud OAuth 2.0 endpoint for authentication. For a web or public app, use /v2/authorize and then /v2/token. For a server-to-server integration, use /v2/token.', errorcode: 10007, documentation: '' }) })
Error: No access token
at FuelSoap. (/Users/ivanchol/Documents/projects/dmc-builder-data-extensions/node_modules/fuel-soap/lib/fuel-soap.js:99:21)
at _requestToken.then.body (/Users/ivanchol/Documents/projects/dmc-builder-data-extensions/node_modules/fuel-auth/lib/fuel-auth.js:91:19)
at process._tickCallback (internal/process/next_tick.js:68:7)

But same code with old credentials working as expected.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.