Nuxtjs: unauthorized: master key is required

In my nuxt app I am trying to call the aggregate function, but I get this error
“unauthorized: master key is required”

I added masterKey in my Moralis start function

// plugin: moralis.js
import Moralis from "moralis/dist/moralis.min.js";

import {,
    MORALIS_APP_ID,
    MORALIS_SERVER_URL,
    MORALIS_APP_ID_TESTNET,
    MORALIS_SERVER_URL_TESTNET,
} from '@/constants/app';

export default async (ctx, inject) => {
    let appId = MORALIS_APP_ID_TESTNET;
    let serverUrl = MORALIS_SERVER_URL_TESTNET;
    
    if(+ctx.env.app.defaultChainId === 56) {
        appId = MORALIS_APP_ID;
        serverUrl = MORALIS_SERVER_URL;
    }

    const masterKey = 'gdgdgdss'
    
    await Moralis.start({ serverUrl, appId, masterKey });
	inject("Moralis", Moralis);
};

// store: action
            const arbitrageStartQuery = new this.$Moralis.Query("ArbitrageStart");
            arbitrageStartQuery.skip(offset * RECORD_COUNT);
            arbitrageStartQuery.limit(RECORD_COUNT)
            arbitrageStartQuery.descending("block_timestamp")
            arbitrageStartQuery.withCount();

            const pipeline = [
                {
                  lookup: {
                    from: "ArbitrageEnd",
                    localField: "block_number",
                    foreignField: "block_number",
                    as: "arbitrageEnd",
                  },
                },
              ];
            const res =  await arbitrageStartQuery.aggregate(pipeline, {useMasterKey: true})

maybe you can import it differently, master key doesn’t work in front end

We usually specify the master key in Moralis.start() method, Is there another way specifying the master key

I wanted to say that in front end will not work even if you specify it, you should import the version of Moralis SDK specific to node js and not one specific to the browser