Jump to content
McKay Development

[Custom storage] Prevent steam-trade-offer-manager to read/write from file system


Recommended Posts

Hi, 

Question
I'm using steam-trade-offer manager and Amazon S3 to store the bot files and don't have RW access to the local file system. How can I use a custom file storage and not read/write from disk?

My attempts

If I set dataDirectory to null (https://github.com/DoctorMcKay/node-steam-user?tab=readme-ov-file#datadirectory)

const client = new SteamUser({ dataDirectory: null });

I get this unexpected error - I'm using client.storage.on callbacks to integrate a custom file storage.
 

Quote

{:stderr, 409, "/app/lib/steam_manager-0.1.0/priv/static/assets/live_bot.js:115\nclient.storage.on('save', function (filename, contents, callback) { handleSave(filename, contents, callback); });\n ^\n\nTypeError: Cannot read properties of undefined (reading 'on')\n at Object.<anonymous> (/app/lib/steam_manager-0.1.0/priv/static/assets/live_bot.js:115:16)\n at Module._compile (node:internal/modules/cjs/loader:1358:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)\n at Module.load (node:internal/modules/cjs/loader:1208:32)\n at Module._load (node:internal/modules/cjs/loader:1024:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)\n at node:internal/main/run_main_module:28:49\n"}

If I don't set dataDirectory to null, I'm able to login but my node js process crashes since I'm not allowed to mkdir. 

Best,
danger

Link to comment
Share on other sites

If you're using a custom storage engine, don't change the value of the dataDirectory option. If you set it to null, the storage property isn't initialized so you get that error attempting to read 'on' of undefined.

steam-tradeoffer-manager uses the same storage scheme as steam-user, but they don't share the same instance. You need to register your save and read events on your TradeOfferManager instance the same way you registered them on your SteamUser instance.

Link to comment
Share on other sites

I've noticed that the library tries to load the machineAuthToken file but it's never found. The file is never provided to the `save` callback and when the lib tries to read it, it's never there - `machineAuthToken.dangercoder.txt File not found in object storage, returning empty string`

Should I expect this file to: 
A ) Be provided in the `save` callback for all login-types? Or is it only for email 2fa?
B ) Try to be loaded via the 'read' callback every time I login? 

Currently B happens but not A.  
 

Link to comment
Share on other sites

That's expected behavior. Machine auth tokens are only issued when you log on with email 2FA, but steam-user attempts to read it every time you log on.

If a request comes in to read a file that doesn't exist, you should return an error, not an empty string.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...