Plugin on node.js debug

I created a plugin which connects to server via API. Code written in node.js. Server-side plugin.
In node JS enviroment everything works perfect and I can see that requests is sending via webhook.

But very same code in bubble doesn’t do anything. No errors. Nothing.
All I can see it’s this message in server logs.

START RequestId: 38bc054f-a274-4b69-918a-f152dddd65c2 Version: $LATEST 2020-05-22T17:05:48.932Z 38bc054f-a274-4b69-918a-f152dddd65c2 INFO { headers: { ‘Content-Type’: ‘application/json’, ‘x-dux-signature’: ‘ae2BMtiQrsLSml5qrPFz0LSM4Lc=’ } } 1590167148932 END RequestId: 38bc054f-a274-4b69-918a-f152dddd65c2 REPORT RequestId: 38bc054f-a274-4b69-918a-f152dddd65c2 Duration: 497.81 ms Billed Duration: 500 ms Memory Size: 128 MB Max Memory Used: 87 MB

And I’m not sure is it contains any error or usefull info.

If anyone has thoughts please respond.

@vini_brito

1 Like

Anyone?

Hard without more information to be able to help. The error message doesn’t say a lot - for me anyway.
You might want to share screenshots of your code? Or sync it to GitHub and share the repository link?

Hello, sure

Script

const jsSHA = require(“jssha/dist/sha1”);
const axios = require(“axios”);

const API_KEY = “A5hXT9GdnlBwRWSRcopNIcYKDEDb56R5”;
const USER_ID = “109083517530567806281”;
const RECIPIRNT_LINK = “https://www.linkedin.com/in/mihail-kuzmin-70128b1aa”;
const COMMAND = “message”;

const url = https://app.dux-soup.com/xapi/remote/control/${USER_ID}/queue;

const message = “Hello from Node js”;

const requestBody = {
command: COMMAND,
targeturl: url,
userid: USER_ID,
timestamp: +new Date(),
params: {
profile: RECIPIRNT_LINK,
messagetext: message,
},
};

const shaObj = new jsSHA(“SHA-1”, “TEXT”, { encoding: “UTF8” });
shaObj.setHMACKey(API_KEY, “TEXT”);
shaObj.update(JSON.stringify(requestBody));

const hmac = shaObj.getHMAC(“B64”);

const hearder = {
headers: {
“Content-Type”: “application/json”,
“x-dux-signature”: hmac,
},
};

axios
.post(url, requestBody, hearder)
.then((data) => {
console.log("RESULT: ", data.data);
})
.catch((error) => console.log("ERROR: ", error));
console.log(hearder, +new Date());

package.js

{
“name”: “duxsoup”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”
},
“keywords”: ,
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“axios”: “^0.19.2”,
“jssha”: “^3.1.0”
}
}