Moralis-admin-cli deploy "unknown problem"

you may need to upload the contents of deploy folder to see something, or maybe there is an error, you can look in browser console

Thank you for quick replay,
what do you mean by upload? where should I include the content?

Regarding to the console, is there any command that I can type to figure out or debug?

After build you have a build folder that you should deploy if is a react app, if is vanilla js you have to upload the folder where index.html is. If you already uploaded you can look in browser console for errors

Yes, I double check now and found build folder in the project but it is empty nothing there?
yes I use react
Should I run, npm build ?

Yes, I think that you should build it first

Thank you very much
it works now
What I have done is:

npm run build

then generate build folder that include index.html

then I run:

C:\Users\user…>moralis-admin-cli deploy --folderPath build
Specify Moralis Api Key: …
Specify Moralis Api Secret: …
Following servers were found:
(0) Marketplace_
What server do you want to connect to?: 0
Deployed successfully!

Now if I want my custom host name? I already have one
is Moralis has any paid service for that? and how I do that?

that custom host name is not yet supported by Moralis Server yet, we are working on implementing it

thank you for quick response,
what about if I take the generated build folder and upload it to third party hosting…
is will work or not? Do I require to provide something there?

Also, I would like ask about the server, every week or so go to sleep? how can I make it as permanent?

Any one want to deploy the Dapp to the network, after testing in a local server please follow the step below to publish your Dapp in the internet network:

  • Update your Server in Moralis
  • Run the following command in your project:
    npm run build
    this will generate a build folder in the project which include index.html
    if there an error try to replace build in package.json as follow:
    “scripts”: {
    “start”: “react-scripts --openssl-legacy-provider start”,
    “build”: “react-scripts --openssl-legacy-provider build”,
    .
    .
    .
    }
  • Then run following:
    npm install -g moralis-admin-cli

and then go to your project folder then run:
C:\Users\user…>moralis-admin-cli deploy --folderPath build
Specify Moralis Api Key: … (these you will find it in your Moralis server under details)
Specify Moralis Api Secret: …
Following servers were found:
(0) Marketplace_
What server do you want to connect to?: 0
Deployed successfully!
Site is available at:… (it will show your site here)
and then you are ready :slight_smile:
I hope this is useful :wink:

you can use any third party hosting for that, it will work without problems

if you get the pro plan then the servers will not go to sleep any more

Thanks
I will look at it :slight_smile:

the site work fine after deploy it
but now when I press refresh, I got error:
404 Not Found nginx/1.18.0 (Ubuntu)
my system is windows not Linux?
one suggested to add file called build/.htaccess
that include:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . ./index.html [L]

or this one:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

but still gave the same error?

BTW with local server, the refresh works fine, it direct to the main page.

what url it tries to access on refresh?

I have Menu in the dapp, so when press refresh button on the page (like bending arrow) it gave error? whereas when I press refresh in local server where my dapp, it works normally and direct to the main menu (one of the page)

it may be related to how redirections are handled in react, it may not work with moralis static hosting, you could try with a third party hosting, you can also try with GitHub pages

OK, thank you
I will try it out

1 Like