Playfab not working on Cocos Creator 3.1

I use Playfab to save player data. It working with Cocos Creator 2.4.5, but with version 3.1.0 it not working and get error:

I install Playfab via npm: npm install playfab-sdk

import { log, _decorator } from 'cc';

import { PlayFab, PlayFabClient } from 'playfab-sdk';

import StorageAdapter from './StorageAdapter';

const { ccclass } = _decorator;


export class PlayFabAdapter extends StorageAdapter {

    constructor (defaultData?: object) {



        PlayFab.settings.titleId = 'xxxxx';


    setStatistics (name: string, value: number) {

        this._set(name, value);

        let playerStatic = {

            Statistics: [{

                StatisticName: name,

                Value: value



        PlayFabClient.UpdatePlayerStatistics(playerStatic, (error, result) => {

            // cc.log(error);

            // cc.log(result);



Anyone can help me fix this error?

Maybe you can refer to this post: Prefab migration plugin update

My problem is Playfab from, not is Prefab

I’m not sure but Cocos Creator v3 seems to support nodejs module not as well as v2.4.5