1

So, I have code bellow:

const { Database, aql }  = require("arangojs");

const db = new Database({·
  url: 'http://127.0.0.1:8529'
} );
db.useBasicAuth('root', 'password1')
(async function() {
  const now = Date.now();
  try {
    const cursor = await db.query(aql`RETURN ${now}`);
    const result = await cursor.next();
  } catch (err) { console.log(err) }
})();

which gives me an error:

TypeError: db.useBasicAuth(...) is not a function

version of the driver is:

"arangojs": "^6.3.0"

Any ideas?

1 Answer 1

2

There is a missing semicolon after call to db.useBasicAuth. The immediate execution function on the next line confuses the "no semicolons anymore" syntax. Its trying to run the result of the useBasicAuth function with the function on the following line as the parameter, but useBasicAuth does not return a function.

This will get rid of the type error:

const { Database, aql }  = require("arangojs");

const db = new Database({·
  url: 'http://127.0.0.1:8529'
} );
db.useBasicAuth('root', 'password1');
(async function() {
  const now = Date.now();
  try {
    const cursor = await db.query(aql`RETURN ${now}`);
    const result = await cursor.next();
  } catch (err) { console.log(err) }
})();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.