Hi there for sure, please see below how the code is structured, and thanks again for the help, much appreciated.
import {Request, Response} from "express";
import * as functions from "firebase-functions";
const Moralis = require('moralis');
const getNFTs = async (req: Request, res: Response) => {
try {
const requestMessage = {
walletAddress: req.query.walletAddress,
chain: req.query.chain,
};
if (!requestMessage) {
res.status(404).send('NFT object not found');
return;
}
if (!requestMessage.walletAddress) {
res.status(404).send('NFT Wallet object not found');
return;
}
if (!requestMessage.chain) {
res.status(404).send('Chain object not found');
return;
}
const api_key = functions.config().moralis.api_key;
if (!Moralis.Core.isStarted) {
await Moralis.start({
apiKey: ?????,
logLevel: 'error',
formatEvmAddress: 'checksum',
formatEvmChainId: 'decimal'
});
}
const response = await Moralis.EvmApi.nft.getWalletNFTs({
address: requestMessage.walletAddress,
chain: requestMessage.chain,
normalizeMetadata: true
});
if (response.result.length > 0) {
return res.status(200).json(response.result);
}
return res.status(200).json('No Content')
} catch (error) {
// @ts-ignore
return res.status(500).json(error.message);
}
}
export { getNFTs }
Then when the app runs i get the following error:
functions: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./.’ is not defined by “exports” in /Users//functions/node_modules/moralis/package.json
I believe it could be to do with the exports section inside the moralis package.json
Any help would be great