[REMOVED SCREENSHOT DUE TO API KEY/SECRET SHOWN]
got this after i ran that command. Not sure how to proceed after this
[REMOVED SCREENSHOT DUE TO API KEY/SECRET SHOWN]
got this after i ran that command. Not sure how to proceed after this
now try the cloud function in your app. Once the code is saved, you will be able to call the cloud function.
import React from âreactâ;
import { Link } from âreact-router-domâ;
import { useEffect } from âreactâ;
import â./Home.cssâ;
import { Logo } from ââŚ/images/Netflixâ;
import { ConnectButton, Icon, TabList, Tab, Button, Modal, useNotification } from âweb3uikitâ;
import { movies } from ââŚ/helpers/libraryâ;
import { useState } from âreactâ;
import { useMoralis } from âreact-moralisâ;
const Home = () => {
const { isAuthenticated, Moralis, account } = useMoralis();
const [visible, setVisible] = useState(false);
const [selectedFilm, setSelectedFilm] = useState();
const [myMovies, setMyMovies] = useState();
const dispatch = useNotification();
useEffect(() => {
async function fetchMyList() {
try {
const theList = await Moralis.Cloud.run("getMyList", { addrs: account });
const filterdA = movies.filter(function (e) {
return theList.indexOf(e.Name) > -1;
});
setMyMovies(filterdA);
} catch (error) {
console.error(error)
}
}
fetchMyList();
}, [account]);
const handleNewNotification = () => {
dispatch({
type: âerrorâ,
message: âPlease Connect Your Walletâ,
title: âNot Authenticatedâ,
position: âbottomRâ
})
}
these errors are related to a different part of the code.
To fix the second error, make sure you have added the appId and serverUrl in the MoralisProvider to start the server.
You can fix the first error by adding unique key values to the image component which is under Home.
i have done that in the index.js file. But doesnt seem to be recognizing it
Your server (qdogsfooe7zj) still doesnât have this getMyList
cloud function saved so thatâs why calling it wonât work.
You need to specify a folder (either a full path, or relative path to where you run the command) with moralis-admin-cli watch-cloud-folder ...
, not a file (cloudcode.js).
You can check your existing cloud code from the Cloud Functions page in server settings (from Moralis admin panel) - refresh the page after you upload any changes.
I am unable to understand the path,
MacBook-Pro-4:Netflix-Starter adenvaz$ moralis-admin-cli watch-cloud-folder --moralisApiKey mviuAMPn2Aev3nU --moralisApiSecret N7R7gCOlZcwCmwv --moralisSubdomain qdogsfooe7zj.usemoralis.com --autoSave 1 --moralisCloudfolder /Netflix-Starter/cloudcode.js
Is it the path to cloud code or some other folder?
The path is to the folder/directory where your cloudcode.js file is. So from your example, it is /Netflix-Starter/
without cloudcode.js as mentioned (if Netflix-Starter is inside the working directory when you run this command). Otherwise just specify a full path to the Netflix-Starter folder.
The terminal is already within the Netflix starter folder. So when i run MacBook-Pro-4:Netflix-Starter adenvaz$ moralis-admin-cli watch-cloud-folder --moralisApiKey mviuAMPn2Aev3nU --moralisApiSecret N7R7gCOlZcwCmwv --moralisSubdomain qdogsfooe7zj.usemoralis.com --autoSave 1 --moralisCloudfolder cloudcode.js
I get this
ncc: Version 0.29.2
ncc: Compiling file index.js into CJS
Changes Uploaded Correctly
But nothing works still
Again, you need to specify the directory, not the file that contains the cloud code. Donât include cloudcode.js in the command.
If you are at Netflix-Starter
as your terminal directory (that has the cloudcode.js file inside it), then use this command:
moralis-admin-cli watch-cloud-folder --moralisApiKey mviuAMPn2Aev3nU --moralisApiSecret N7R7gCOlZcwCmwv --moralisSubdomain qdogsfooe7zj.usemoralis.com --autoSave 1 --moralisCloudfolder ./
If that doesnât work, go up one directory and then use:
moralis-admin-cli watch-cloud-folder --moralisApiKey mviuAMPn2Aev3nU --moralisApiSecret N7R7gCOlZcwCmwv --moralisSubdomain qdogsfooe7zj.usemoralis.com --autoSave 1 --moralisCloudfolder Netflix-Starter
ApiSecret N7R7gCOlZcwCmwv --moralisSubdomain qdogsfooe7zj.usemoralis.com --autoSave 1 --moralisCloudfolder ./
| Listening folder: ./[SyntaxError: âimportâ and âexportâ may appear only with âsourceType: moduleâ] {
line: 1,
column: 1,
annotated: â\nâ +
â./node_modules/@ant-design/colors/dist/index.esm.js:1\nâ +
âimport { inputToRGB, rgbToHex, rgbToHsv } from â@ctrl/tinycolorâ;\nâ +
â^\nâ +
âParseError: âimportâ and âexportâ may appear only with âsourceType: moduleââ
}
[SyntaxError: âimportâ and âexportâ may appear only with âsourceType: moduleâ] {
line: 1,
column: 1,
annotated: â\nâ +
â./node_modules/@ant-design/colors/dist/index.esm.js:1\nâ +
âimport { inputToRGB, rgbToHex, rgbToHsv } from â@ctrl/tinycolorâ;\nâ +
â^\nâ +
âParseError: âimportâ and âexportâ may appear only with âsourceType: moduleââ
}
[SyntaxError: âimportâ and âexportâ may appear only with âsourceType: moduleâ] {
line: 1,
TypeError: Cannot read properties of undefined (reading âlengthâ)
at Glob. (/opt/homebrew/lib/node_modules/moralis-admin-cli/commands/watchCloudFolder.js:96:56)
at Glob.f (/opt/homebrew/lib/node_modules/moralis-admin-cli/node_modules/once/once.js:25:25)
at Glob.emit (node:events:513:28)
at Glob.emit (node:domain:489:12)
at Glob._readdirError (/opt/homebrew/lib/node_modules/moralis-admin-cli/node_modules/glob/glob.js:610:14)
at /opt/homebrew/lib/node_modules/moralis-admin-cli/node_modules/glob/glob.js:553:12
at go$readdir$cb (/opt/homebrew/lib/node_modules/moralis-admin-cli/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:826734)
at FSReqCallback.oncomplete (node:fs:201:23)
| Listening folder: /
./node_modules/@ant-design/colors/dist/index.esm.js:1\n
Where is this use of ant-design
coming from or what is in that cloudcode.js? Read this for what cloud functions/cloud code is for. You canât import libraries like that.
Start with a simple comment inside cloudcode.js e.g. //uploaded
to show that you can upload changes.
Hi, All
I am facing an issue, once i click the âsignâ button which prompts from metamask, nothing happens, my account also doesnât connect and no error pops out too. It simply keeps prompting again and again!
Can anyone help please?
Can you check your browser console and your terminal for any errors. Have you put your correct Moralis server details in MoralisProvider?
My CSS Wonât Load When Deployed? But Works Fine on The Local Host , How Can I Fix That?
Do you have a link to your deployed site? Does it work locally (npm run build
/ yarn build
and then serve the build
folder with a local webserver)?
Make sure youâre not using generated class names in your CSS - these class names will change once deployed so they wonât work.