-
-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Describe the bug
When creating 2 separate fms-api-client clients for different files, and making a single async calls with each client, the second call will fail.
Expected behavior
It's unexpected that completely separate clients would affect each other. It seems as though there is some sort of collision between the clients that is causing the wrong token to be used.
Code Examples
const { Filemaker } = require("fms-api-client");
const { connect } = require("marpat");
require("dotenv").config({ path: "./.env" });
connect("nedb://memory").then(() => {
const fmsApiClient1 = Filemaker.create({
name: `client-database1`,
database: "database1",
concurrency: 30,
server: `${process.env.URL}`,
user: `${process.env.USERNAME}`,
password: `${process.env.PASSWORD}`,
usage: true,
timeout: 60000,
});
const client1 = fmsApiClient1.save();
const fmsApiClient2 = Filemaker.create({
name: `client-database2`,
database: "database2",
concurrency: 30,
server: `${process.env.URL}`,
user: `${process.env.USERNAME}`,
password: `${process.env.PASSWORD}`,
usage: true,
timeout: 60000,
});
const client2 = fmsApiClient2.save();
Promise.all([client1, client2])
.then(([db1Client, db2Client]) => {
db1Client.layout("REST_Value_Lists")
.then((result) => {
console.log("Result of db1Client");
})
.catch((err) => {
console.log("Error of db1Client");
});
db2Client.layout("REST_Value_Lists")
.then((result) => {
console.log("Result of db2Client");
})
.catch((err) => {
console.log("Error of db2Client");
});
})
});
Additional context
I'm not sure really where to look on this one. Any help knowing where to look would be great. Have VS Code debugger hooked up but still not being able to really track what it going on.
How does fms-api-client decide when to look for a new token. Seems to be in the agent.model file but can't track it down.
Thanks
Metadata
Metadata
Assignees
Labels
No labels