Error at Protocol._enqueue (/var/task/node_modules/mysql/lib/protocol - mysql

Currently I want to access MySQL Aurora DB from inside a lambda function.
I have both the Aurora and the lambda in same VPC, subnets and security group.
The following is the lambda function code:
console.log("Welcome to lambda")
var connection = mysql.createConnection({
host: 'aurora-test1-us-mysql-multilevel.cluster-cutke7yxox3c.us-west-2.rds.amazonaws.com',
database: 'aurora-test1-us-mysql-multilevel',
user: "***",
password: "***",
});
console.log("createConnection",connection)
let con = connection.connect();
console.log("connect:",con)
const query = connection.query('USE feature;SELECT * FROM feature;')
console.log("query",query)
connection.end();
return {
statusCode: 200,
body: "HELLO KIMOO!!! Welcome TO AURORA DB" + "Database Created2"
}
}
catch(err)
{
console.log("Error caught",err)
return {
statusCode: 500,
body: JSON.stringify({
message: 'Error: ' + err
})
}
}
The following is the output received from logging the query
_events: [Object: null prototype] {
error: [Function (anonymous)],
packet: [Function (anonymous)],
timeout: [Function (anonymous)],
end: [Function (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
_callback: undefined,
_callSite: Error
at Protocol._enqueue (/var/task/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Connection.query (/var/task/node_modules/mysql/lib/Connection.js:198:25)
at Runtime.<anonymous> (/var/task/index.js:39:38)
at Generator.next (<anonymous>)
at /var/task/index.js:8:71
at new Promise (<anonymous>)
at __awaiter (/var/task/index.js:4:12)
at Runtime.handler (/var/task/index.js:17:12)
at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1089:29),
_ended: false,
_timeout: undefined,
_timer: Timer { _object: [Circular *1], _timeout: null },
sql: 'USE feature;SELECT * FROM feature;',
values: undefined,
typeCast: true,
nestTables: false,
_resultSet: null,
_results: [],
_fields: [],
_index: 0,
_loadError: null,
_connection: <ref *2> Connection {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
config: ConnectionConfig {
host: 'aurora-test1-us-mysql-multilevel.cluster-cutke7yxox3c.us-west-2.rds.amazonaws.com',
port: 3306, ......
I don't understand what does this error mean and how can I connect to Aurora and retrieve data from it successfully
Note:
I'm using Typescript
I'm using mysql library

Related

Query from Nodejs returning undefined results

I have a table in my database and my connection is definitely up, ive tested the query itself in mysql workbench but when i log the results (and results[0]) i get undefined values and there is definintely values in the table
I'm fairly certain its how i set up the mysql server but i have no idea how to check.
any ideas? thanks in advance
server.js
dbCon.connect((err) => {
if (err) throw err;
console.log("db Connected");
});
app.set('view engine', 'ejs');
//app.use(express.static(__dirname));
let test = dbCon.query("SELECT * FROM tools", function (err, result) {
if (err) {
console.log("query error");
console.log(result);
}
return result
console.log(test[0]);
});
This is what i get out of the console:
Query {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
next: null,
sql: 'SELECT * FROM tools',
values: undefined,
_queryOptions: { rowsAsArray: false, sql: 'SELECT * FROM tools', values: undefined },
namedPlaceholders: false,
onResult: [Function (anonymous)],
timeout: undefined,
queryTimeout: null,
_fieldCount: 0,
_rowParser: null,
_fields: [],
_rows: [],
_receivedFieldsCount: 0,
_resultIndex: 0,
_localStream: null,
_unpipeStream: [Function (anonymous)],
_streamFactory: undefined,
_connection: null,
[Symbol(kCapture)]: false
}

how to use the return value in arrow function in node-js

I am working in express and Node-js and I am working in MySql in Node. I want to store the user data in the database but checking whether the user is already present or not. the working is that on the starting of the function it call the userpresent function to check that the is present or not. I want to return the true or false but I is returning an object and I cannot handle it the code is what I do in this code to use the return value(which must be true or false) in route function:
const express = require('express');
const router = express.Router();
const database = require('../DBconfig');
var mysql = require('mysql');
const { body, validationResult } = require('express-validator');
// to make connection with the database
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'root',
database: 'yourguide',
});
// connection statement is end
//the route function is start
// here I added some express validators
router.post(
'/signup',
[
body('username', 'enter username of min 4 character').isLength({ min: 3 }),
body('firstName', 'enter firstName of min 3 character').isLength({
min: 3,
}),
body('lastName', 'enter lastname of min 3 character').isLength({ min: 3 }),
body('password', 'enter password of min 4 character').isLength({ min: 4 }),
body('city', 'enter city of min 4 character').isLength({ min: 4 }),
body('email', 'entera valid email').isEmail(),
],
async (req, res) => {
const error = validationResult(req);
//check that the user enter a valid input
var flag = await userPresent(req.body.username, req.body.email);
if (!error.isEmpty()) {
return res.status(400).json({ error: error.array() });
} else {
// if the input is valid then start to check the user
await connection.connect(function (err) {
if (err) console.log('not conntected to table');
else console.log('connected to table');
// call the async function to check the presence of the user
console.log('flag in main is ');
console.log(flag);
//check the return value of the fucntion
//if the user is not present then execute the if statement
if (!flag) {
//make the query
var query = `INSERT INTO users(firstName, lastName, username, email, city, password) VALUES ("${req.body.firstName}","${req.body.lastName}","${req.body.username}","${req.body.email}","${req.body.city}","${req.body.password}")`;
console.log(query);
connection.query(query, function (err, result) {
if (err) {
flag = false;
console.log('not inserted');
return flag;
} else {
flag = true;
console.log('inserted');
return flag;
}
});
return res.body;
} else {
return res
.status(400)
.json({ error: 'given email or username is already exist' });
}
});
}
}
);
//async function to check the user presence
userPresent = async (username, email) => {
//initialize the flag with true
let data = '';
//make query to check the user
var query = `SELECT * FROM users WHERE username= "${username}" AND email="${email}" `;
data = await connection.query(
query,
(present = (err, result) => {
return result != null;
})
);
console.log('data is ', data);
};
the userpresent function return the object
_events: [Object: null prototype] {
error: [Function (anonymous)],
packet: [Function (anonymous)],
timeout: [Function (anonymous)],
end: [Function (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
_callback: [Function (anonymous)],
_callSite: Error
at Protocol._enqueue (D:\practise\yourguide\yourguide\backend\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Connection.query (D:\practise\yourguide\yourguide\backend\node_modules\mysql\lib\Connection.js:198:25)
at userPresent (D:\practise\yourguide\yourguide\backend\routes\user.js:83:29)
at D:\practise\yourguide\yourguide\backend\routes\user.js:28:22
at Layer.handle [as handle_request] (D:\practise\yourguide\yourguide\node_modules\express\lib\router\layer.js:95:5)
at next (D:\practise\yourguide\yourguide\node_modules\express\lib\router\route.js:137:13)
at middleware (D:\practise\yourguide\yourguide\backend\node_modules\express-validator\src\middlewares\check.js:16:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5),
_ended: false,
_timeout: undefined,
_timer: Timer { _object: [Circular *1], _timeout: null },
sql: 'SELECT * FROM users WHERE username= "harry13" AND email="harry13#gmail.com" ',
values: undefined,
typeCast: true,
nestTables: false,
_resultSet: null,
_results: [],
_fields: [],
_index: 0,
_loadError: null,
_connection: <ref *2> Connection {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
config: ConnectionConfig {
host: 'localhost',
port: 3306,
localAddress: undefined,
socketPath: undefined,
user: 'root',
password: 'root',
database: 'yourguide',
connectTimeout: 10000,
insecureAuth: false,
supportBigNumbers: false,
bigNumberStrings: false,
dateStrings: false,
debug: undefined,
trace: true,
stringifyObjects: false,
timezone: 'local',
flags: '',
queryFormat: undefined,
pool: undefined,
ssl: false,
localInfile: true,
multipleStatements: false,
typeCast: true,
maxPacketSize: 0,
charsetNumber: 33,
clientFlags: 455631
},
_socket: Socket {
connecting: true,
_hadError: false,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
timeout: 10000,
[Symbol(async_id_symbol)]: 36,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 10000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 3579,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 39,
[Symbol(triggerId)]: 0
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_protocol: Protocol {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
readable: true,
writable: true,
_config: [ConnectionConfig],
_connection: [Circular *2],
_callback: null,
_fatalError: null,
_quitSequence: null,
_handshake: true,
_handshaked: false,
_ended: false,
_destroyed: false,
_queue: [Array],
_handshakeInitializationPacket: null,
_parser: [Parser],
[Symbol(kCapture)]: false
},
_connectCalled: true,
state: 'disconnected',
threadId: null,
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false
}
what I do to return the true or false to use in our route function

How to promisify a mysql pool connection in Node js?

I'm trying to understand how to use the node js util to promisify pool connections.
I would keep my code clean using async/await logic ( without the callback hell, that I really don't like especially with transactions ).
here is my config file:
const mysql = require('mysql');
const util = require('util');
const pool = mysql.createPool({
connectionLimit: 10,
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME
});
// Ping database to check for common exception errors.
pool.getConnection((err, connection) => {
if (err) {
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
console.error('Database connection was closed.')
}
if (err.code === 'ER_CON_COUNT_ERROR') {
console.error('Database has too many connections.')
}
if (err.code === 'ECONNREFUSED') {
console.error('Database connection was refused.')
}
}
if (connection) connection.release();
return;
})
// Promisify for Node.js async/await.
pool.query = util.promisify(pool.query)
module.exports = pool;
I'm executing single easy queries like this (and they work fine):
let sql = "SELECT * FROM products WHERE code = ? ;"
let param = [code];
let results = await pool.query(sql, param);
I'm developing transactions in this way ( I think it is a completely wrong approach ):
try {
await pool.query('START TRANSACTION');
sql = "INSERT INTO test (name) VALUES ( ? ) ;"
param = ['pippo'];
results = []
await pool.query(sql, param);
await pool.query('COMMIT');
} catch (error) {
await pool.query('ROLLBACK');
return next(error)
}
With transactions I shouldn't use pool.query ( that, I think, get each time a new connection and automatically release it when the query is finished ).
It seems to me that pool.query create a big problem with transactions:
If just run one transaction at a time is ok, but if run 2 (or more) transactions at the same time maybe the COMMIT of the second transaction can COMMIT all the queries of the first transaction just because is executed before the first COMMIT.
I think I should instead get a new connection use the connection for the entire flow of the transaction and release it at the end. So each transaction flow needs an own connection.
But I don't know how to promisify a pool.getConnection as I promisify the pool.query.
I was trying something like:
pool.getConnection = util.promisify(pool.getConnection).bind(pool)
const conn = await pool.getConnection();
let sql = "SELECT * FROM test ;"
let param = [];
let results = await conn.query(sql); // I don't get here the expected rows
but it doesn't work. I don't become the rows in result but if i console.log(results) I have this:
Query {
_events: [Object: null prototype] {
error: [Function],
packet: [Function],
timeout: [Function],
end: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_callback: undefined,
_callSite: Error
at Protocol._enqueue (C:\Users\rocco\wa\ferramenta\server\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at PoolConnection.query (C:\Users\rocco\wa\ferramenta\server\node_modules\mysql\lib\Connection.js:198:25)
at C:\Users\rocco\wa\ferramenta\server\routes\imports.js:304:30
at processTicksAndRejections (internal/process/task_queues.js:97:5),
_ended: false,
_timeout: undefined,
_timer: Timer { _object: [Circular], _timeout: null },
sql: 'SELECT * FROM test ; ',
values: [],
typeCast: true,
nestTables: false,
_resultSet: null,
_results: [],
_fields: [],
_index: 0,
_loadError: null,
_connection: PoolConnection {
_events: [Object: null prototype] {
end: [Function: _removeFromPool],
error: [Function]
},
_eventsCount: 2,
_maxListeners: undefined,
config: ConnectionConfig {
host: 'localhost',
port: '3306',
localAddress: undefined,
socketPath: undefined,
user: 'root',
password: '---myPassword---',
database: '---nameOfMyDb---',
connectTimeout: 10000,
insecureAuth: false,
supportBigNumbers: false,
bigNumberStrings: false,
dateStrings: false,
debug: undefined,
trace: true,
stringifyObjects: false,
timezone: 'local',
flags: '',
queryFormat: undefined,
pool: [Pool],
ssl: false,
localInfile: true,
multipleStatements: false,
typeCast: true,
maxPacketSize: 0,
charsetNumber: 33,
clientFlags: 455631,
protocol41: true
},
_socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
timeout: 0,
[Symbol(asyncId)]: 11,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: -1,
_idlePrev: null,
_idleNext: null,
_idleStart: 1284,
_onTimeout: null,
_timerArgs: undefined,
_repeat: null,
_destroyed: true,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 14,
[Symbol(triggerId)]: 1
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_protocol: Protocol {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
readable: true,
writable: true,
_config: [ConnectionConfig],
_connection: [Circular],
_callback: null,
_fatalError: null,
_quitSequence: null,
_handshake: true,
_handshaked: true,
_ended: false,
_destroyed: false,
_queue: [Array],
_handshakeInitializationPacket: [HandshakeInitializationPacket],
_parser: [Parser],
[Symbol(kCapture)]: false
},
_connectCalled: true,
state: 'authenticated',
threadId: 117,
_pool: Pool {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
config: [PoolConfig],
_acquiringConnections: [],
_allConnections: [Array],
_freeConnections: [],
_connectionQueue: [],
_closed: false,
query: [Function],
getConnection: [Function: bound ],
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false
}
Some ideas ?
THX
Here is an easy example about how I solved it:
pool.getConnection = util.promisify(pool.getConnection)
let conn = await pool.getConnection();
conn.query = util.promisify(conn.query)
sql = "INSERT INTO test (name) VALUES ( ? ) ; ";
param = ['fakename'];
results = [];
results = await conn.query(sql, param)
conn.release(); // is important remember to release the connection

AWS lambda API REST I can't get results with MySQL and Node.js

I'm new in node.js. I using AWS with node.js and MySQL to create a lambda function, but I can't catch the results in my handler, my database instance it's in RDS service.
When I launch my callback in the console it shows me a giant and unreadable json with information from the database but not from the records that I am consulting, why is this? because it happens, am I doing something wrong?
This is my code:
'use strict';
const AWS = require("aws-sdk");
AWS.config.update( { region: "us-west-2" } );
var mysql = require('mysql');
var querystring = require('querystring');
const con = mysql.createConnection({
host : process.env.RDS_HOSTNAME,
user : process.env.RDS_USERNAME,
password : process.env.RDS_PASSWORD,
database : process.env.RDS_DB_NAME
});
exports.handler = async (event, context, callback) => {
context.callbackWaitsForEmptyEventLoop = false;
const results = await con.query('SELECT * FROM `documentoApp_rptenviadoclon`;');
await con.end();
if (results) {
callback(null, {
statusCode: 200,
headers: {
'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization,X-Requested-With',
'Access-Control-Allow-Methods': 'GET,POST,OPTIONS',
'Access-Control-Allow-Origin': '*'
},
body: JSON.stringify(results)
});
} else {
callback('error', {
statusCode: 400,
headers: {
'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization,X-Requested-With',
'Access-Control-Allow-Methods': 'GET,POST,OPTIONS',
'Access-Control-Allow-Origin': '*'
},
body: {
message: 'No results found.'
},
});
}
};
I tried to put a console.log in response body and this is what it shows, the giant and illegible json of which I speak:
START RequestId: 80dfacdb-034b-41bc-8c53-e5eb3347d035 Version: $LATEST
2020-03-20T21:57:15.134Z 80dfacdb-034b-41bc-8c53-e5eb3347d035 INFO Query {
_events: [Object: null prototype] {
error: [Function],
packet: [Function],
timeout: [Function],
end: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_callback: undefined,
_callSite: Error
at Protocol._enqueue (/var/task/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Connection.query (/var/task/node_modules/mysql/lib/Connection.js:198:25)
at Runtime.exports.handler (/var/task/index.js:19:31)
at Runtime.handleOnce (/var/runtime/Runtime.js:66:25),
_ended: false,
_timeout: undefined,
_timer: Timer { _object: [Circular], _timeout: null },
sql: 'SELECT * FROM `documentoApp_rptenviadoclon`;',
values: undefined,
typeCast: true,
nestTables: false,
_resultSet: null,
_results: [],
_fields: [],
_index: 0,
_loadError: null,
_connection: Connection {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
config: ConnectionConfig {
host: '--hidden--',
port: 3306,
localAddress: undefined,
socketPath: undefined,
user: '--hidden--',
password: '--hidden--',
database: '--hidden--',
connectTimeout: 10000,
insecureAuth: false,
supportBigNumbers: false,
bigNumberStrings: false,
dateStrings: false,
debug: undefined,
trace: true,
stringifyObjects: false,
timezone: 'local',
flags: '',
queryFormat: undefined,
pool: undefined,
ssl: false,
localInfile: true,
multipleStatements: false,
typeCast: true,
maxPacketSize: 0,
charsetNumber: 33,
clientFlags: 455631
},
_socket: Socket {
connecting: true,
_hadError: false,
_parent: null,
_host: 'dbportalreportes-dev.cjawt1xkypqu.us-west-2.rds.amazonaws.com',
_readableState: [ReadableState],
readable: false,
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
timeout: 10000,
[Symbol(asyncId)]: 3,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 10000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 469,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(asyncId)]: 7,
[Symbol(triggerId)]: 0
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_protocol: Protocol {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
readable: true,
writable: true,
_config: [ConnectionConfig],
_connection: [Circular],
_callback: null,
_fatalError: null,
_quitSequence: [Quit],
_handshake: true,
_handshaked: false,
_ended: false,
_destroyed: false,
_queue: [Array],
_handshakeInitializationPacket: null,
_parser: [Parser]
},
_connectCalled: true,
state: 'disconnected',
threadId: null
}
}
END RequestId: 80dfacdb-034b-41bc-8c53-e5eb3347d035
REPORT RequestId: 80dfacdb-034b-41bc-8c53-e5eb3347d035 Duration: 208.98 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 92 MB Init Duration: 415.02 ms
I hope you can help me, thank you very much!

2 Legged Authorization Failure on Locked Down Network

I am very new to Forge and we are trying to run the tutorial on our work network.
Our network is very locked down so I have had to get the ‘developer.api.autodesk.com’ to the Cisco HTTPS Exceptions list.
Is there any other pages I need to add to get the 2 legged Authorization working.
When I click on 'Authorize Me' button on the local host I get 'Failed to Authorize' show up on the web page.
The report I get back on the node.js command prompt is as below (Client ID etc changed)
Any help appreciated.
> viewer-walkthrough-online.viewer#2.0.0 start C:\APA_Testing\Forge\walkthrough
> node start.js
Server listening on port 3000
{ Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1058:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket._finishInit (_tls_wrap.js:636:8)
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
{ Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'axios/0.18.1',
'Content-Length': 186 },
method: 'post',
url:
'https://developer.api.autodesk.com/authentication/v1/authenticate',
data:
'client_id=XXXXXXXXXXXXXXXX&client_secret=XXXXXXXXXX&grant_type=client_credentials&scope=data%3Aread%20data%3Awrite%20data%3Acreate%20bucket%3Acreate%20bucket%3Aread' },
request:
Writable {
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
_events:
[Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError] },
_eventsCount: 2,
_maxListeners: undefined,
_options:
{ protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/authentication/v1/authenticate',
method: 'post',
headers: [Object],
agent: undefined,
auth: undefined,
hostname: 'developer.api.autodesk.com',
port: null,
nativeProtocols: [Object],
pathname: '/authentication/v1/authenticate' },
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 186,
_requestBodyBuffers: [ [Object] ],
_onNativeResponse: [Function],
_currentRequest:
ClientRequest {
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header:
'POST /authentication/v1/authenticate HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nContent-Type: application/x-www-form-urlencoded\r\nUser-Agent: axios/0.18.1\r\nContent-Length: 186\r\nHost: developer.api.autodesk.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/authentication/v1/authenticate',
_ended: false,
res: null,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: [Circular],
[Symbol(isCorked)]: false,
[Symbol(outHeadersKey)]: [Object] },
_currentUrl:
'https://developer.api.autodesk.com/authentication/v1/authenticate' },
response: undefined }
The only host you need to whitelist is developer.api.autodesk.com - all our endpoints are on this domain.
Actually the error is complaining about not being able to locate the SSL certificates that should be present in your local vault to verify the connections - test if the error persists if you use tools like cURL/Postman to call our APIs and ask your network administrator for help on this.
As a temporary workaround absolutely not recommended due for security reasons you can disable check for SSL issues following here - simply add the code to the Axios config in start.js