Hello, I'm trying to refactor my service in Svelte-kit, and I've been running into quite tedious errors when testing and initializing a user.
Here is a quick test when a user sends a post request, which would initialize the user, run some business logic, and then log off.
I've ran essentially the same code in an express environment, with the same environment variables, which worked fine.
export const POST = async ({request:request}) => {
//TODO
const client = new SteamUser();
const community = new SteamCommunity();
const manager = new TradeOfferManager({
steam: client,
community: community,
language: 'en',
});
const cred = {
accountName: STEAM_NAME,
password: STEAM_PASS,
twoFactorCode: SteamTotp.generateAuthCode(STEAM_SHARED),
logonID: 12345
};
client.logOn(cred); // logging on
client.on('loggedOn', async () => {
console.log('logged into steam');
client.setPersona(SteamUser.EPersonaState.Online)
})
client.on('webSession', (sessionid, cookies) => {
manager.setCookies(cookies);
community.setCookies(cookies);
community.startConfirmationChecker(12500, STEAM_IDENTITY);
})
async function doTradeStuff() {
//TODO
} //await doTradeStuff()
client.logOff(); // logging off
client.on('disconnected', async (eresult, msg) => {
console.log('logged off steam', eresult, msg)
})
return json({place: 'holder'})
}
Firstly, in all of the iterations I've made, I keep getting this `Error: LogonSessionReplaced 34`, which your documentation states could be mitigated / prevented by the logonID property when using the logOn method https://github.com/DoctorMcKay/node-steam-user#logondetails. However the issue still persists.
Secondly, the logOff method never runs in the serverless environment, as I do not get a disconnected event. https://github.com/DoctorMcKay/node-steam-user#disconnected
So, I'm looking for any guidance / hint as to where to look, where I'm going wrong, if there's better practice, what to be aware about if I'm trying to run this in a serverless environment, etc. Thanks for your libraries.