DoctorMcKay/node-steam-tradeoffer-manager

Error 26 on trades sent on production

Baryshych opened this issue · 6 comments

HI! I`m getting error 26 (trade revoked) while sending trade on my production server, but on my local everything is okay. Account are functional, with deposit and game launched before.

Trade sending code:

Bot.prototype.sendOffer = async function sendOffer(
  sid,
  token,
  steamItem,
  message,
) {
  let steamId = new SteamID(`${sid}`);
  if (
    !steamId.isValid ||
    !steamId.isValid() ||
    steamId.type !== SteamID.Type.INDIVIDUAL
  ) {
    steamId = SteamID.fromIndividualAccountID(sid);
  }
  try {
    const offer = this.manager.createOffer(
      `${steamId.getSteamID64()}`,
      `${token}`,
    );
    offer.addMyItems([steamItem]);
    if (message) {
      offer.setMessage(message);
    }
    });
    let status;
    try {
      status = await new Promise((res, rej) =>
        offer.send((err, stat) => (err ? rej(err) : res(stat))),
      );
    } catch (e) {
      status = `Offer sending err:${e}`;
      if (e.message === 'Not Logged In') {
        await this.client.relog();
      } else {
        ...
      }
      await log.save();
      throw new Error(e);
    }
    if (status === 'pending') {
      try {
        await new Promise((res, rej) => {
          this.community.acceptConfirmationForObject(
            this.bot.identity_secret,
            offer.id,
            err => (err ? rej(err) : res()),
          );
        });      } catch (e) {
...
      }
    } else {
...
    }
    return offer;
  } catch (e) {
...
  }
};

Steam item schema:

id               serial                                              not null
    constraint "SteamItem_pkey"
    primary key,
  inventoryid      varchar(255)                                        not null,
  classid          varchar(255)                                        not null,
  instanceid       varchar(255)                                        not null,
  contextid        varchar(255)                                        not null,
  assetid          varchar(255)                                        not null,
  icon_url         varchar(511),
  name             varchar(255)                                        not null,
  market_hash_name varchar(255),
  market_name      varchar(255),
  type             varchar(255)                                        not null,
  name_color       varchar(255),
  background_color varchar(255),
  tradable         boolean default false                               not null,
  marketable       boolean default false                               not null,
  commodity        boolean default false                               not null,
  appid            varchar(255),
  "createdAt"      timestamp with time zone                            not null,
  "updatedAt"      timestamp with time zone                            not null,
  status           varchar(255) default 'unknown' :: character varying not null

NB: i have Ubuntu on local and Arch in prod. Could different http clients be the cause?

The items are 100% presented, as I can resend the same trade from my local machine later on

Dunno what to tell you. Steam doesn't seem to agree.

@Baryshych you solved the error?

It was a while ago, so I`m not sure, but one of this helped:

  • Waiting. Sometimes I was able to send it in a while.
  • Checking threads - I was calling the API from different thread from which I logged in.
    I`m still getting it sometimes, but it occurs less