Next.js Discord

Discord Forum

Steam Login

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Hello, I'm creating an application to log in with Steam.
For this I am using passport and passport-steam.

In development everything is perfect, but when deploying to Vercel, it gives me the following error:

./lib/passport.ts:32:5
Type error: Argument of type '(_: string, profile: SteamProfile, done: (a: null | string, b: SteamProfile) => typeof done) => (a: null | string, b: SteamProfile) => typeof done' is not assignable to parameter of type '(identifier: string, profile: SteamProfile, done: DoneFn) => void'.
  Types of parameters 'profile' and 'profile' are incompatible.
    Property 'identifier' is missing in type 'SteamProfile' but required in type 'import("/vercel/path0/lib/passport").SteamProfile'.
  30 |       apiKey: `${process.env.STEAM_API_KEY}`,
  31 |     },
> 32 |     (
     |     ^
  33 |       _:string,
  34 |       profile: SteamProfile,
  35 |       done: (a: null | string, b: SteamProfile) => typeof done
Static worker exited with code: 1 and signal: null
Error: Command "npm run build" exited with 1


import passport from "passport";
import passportSteam from "passport-steam";

const SteamStrategy = passportSteam.Strategy;

export interface SteamProfile {
  displayName: string;
  id: string;
  identifier: string;
  photos: Image;
  provider: string;
}

interface Image {
  value: string;
}
passport.serializeUser(function (user, done) {
  done(null, user);
});

passport.deserializeUser(function (obj: SteamProfile, done) {
  done(null, obj);
});

passport.use(
  new SteamStrategy(
    {
      returnURL: `${process.env.DOMAIN}/api/auth/return`,
      realm: `${process.env.DOMAIN}`,
      apiKey: `${process.env.STEAM_API_KEY}`,
    },
    (
      _: string,
      profile: SteamProfile,
      done: (a: null | string, b: SteamProfile) => typeof done
    ) => {
      // Fetch any more information to populate
      return done(null, profile);
    }
  )
);

export default passport;


Can anyone help me?

0 Replies