Can't get things up and running by following "Get Started" guide (neither local server nor production deploy)

Hi,

I’m a first time user of Webiny, so probably I’ve messed up something, but I can’t get started by following the Quick Start guide. Here I’ll also share feedback about docs and other stuff that might be useful for improving your DX.

  1. I have all the pre-requisites (AWS credentials and MongoDB at Atlas)

  2. I created a new project with npx create-webiny-project new-project --template=cms and I got everything installed with the 4.0.2 version.

  3. Following the tutorial I found one thing that kind of confused me: the Mongo configuration at getting started guide says:

     "MONGODB_SERVER": "mongodb+srv://{YOUR_USERNAME}:{YOUR_PASSWORD}@someclustername.mongodb.net",
     "MONGODB_NAME": "{YOUR_MONGODB_NAME}",
    

However, in the going live section:

"MONGODB_SERVER": "mongodb+srv://username:[email protected]/test?retryWrites=true",
"MONGODB_NAME": "webiny-72858e17"

As you can see, the connection URL ends with /test?retryWrites=true, I think this indicates that the database name is test, but if it’s defined here, why do we need the “MONGODB_NAME” setting? In my MongoDB atlas account I have 1 database called “webiny-test” with 1 collection called “webiny-test”, so i just left /webiny-test?retryWrites=true at the end of my “MONGODB_SERVER” var and also set “MONGODB_NAME” to webiny-test.

  1. I changed the “AWS_PROFILE” and “AWS_REGION”. The profile has admin access to all my AWS account.

  2. Deployed the API with yarn webiny deploy api --env=dev. Everything seems ok (I wait some minutes to make sure changes propagate).

  3. Another confusing point. After the API deploy command finishes it shows a message in the console that says the next step is cd apps/admin then yarn start, but in the getting started guide says that the next step is to deploy the apps. I assume there’s no need to start the server locally before deploying so I just follow the guide and do yarn webiny deploy apps --env=dev. Everything seems to finish allright.

  4. Ok, now I have all my webiny apps deployed, so I go to the admin link https://xyz.cloudfront.net/admin/ and I’m prompted with a “Install Security” form. This is clearly to create a new admin user as it says “Let’s create your admin user:”, so I introduce new credentials, click on “Install Security” button and it returns an error: Something went wrong. User does not exist. At this point I don’t really know what to do, as there are no docs for this part =(

  5. At this point I think maybe I had to run my app locally first to configure some stuff. So I go to my terminal and run cd apps/admin and yarn start. This builds the project with no issues and opens http://localhost:3001/ in my browser, but I just can see this:

Changing the address to my IP doesn’t work neither.

  1. Hmm, maybe the API was not deployed correctly. I try to scroll up to review the output of the command at 5) but I discover your CLI erases the terminal output (please, don’t do this). Anyway, I decide to change the “MONGODB_SERVER” to remove the last /webiny-test part and run the command again: yarn webiny deploy api --env=dev. Surprisingly, this time it ends up with an error:

     webiny An error occurred during deployment of filesBucket +905ms
     Error: Forbidden: Invalid credentials or this AWS S3 bucket name may already be taken
    
  2. I give up and write this long post :wink:

Can someone help me?

Hi @ericmarcos, let me try to clear things up a little bit:

Let’s start with Mongo variables: Webiny uses these 2 variables because we need to know the connection string and we need to know the database name. We don’t know where your MongoDB can possibly be hosted, so we rely on those 2 variables. Whatever you put into them - that’s what we use. Mongo Atlas includes that /test string in the connection string for some reason, and it doesn’t work if you remove it. Your connection string can be anything as long as it connects you to your DB. Then we just select the active database by using the MONGODB_NAME variable.

Moving on to the --env:
Your first problem started with the command yarn webiny deploy api --env=dev. You used the dev environment, which is wrong, and is mentioned only in Going Live article so you jumped to that before finishing the local setup (that’s also our mistake, the docs are obviously not clear enough).
At the end of the Quick Start article you’ll notice there is a link to template-specific article for CMS and there you’ll see the correct command with --env=local.

So to develop your React app locally, you first need to deploy a local env for your API. That’s what Quick Start article is about. Just the local setup. It may sound weird that for local setup you need to deploy an API to AWS, but what it means is Deploy an instance of API which will be used for your local development of React apps. This is cloud-native development, and we use the actual cloud resources even when developing locally with React.

Points 8) and 9) of your question are actually caused by jumping between environments in the wrong order.

Now to the most important problem - point 7): this issue is something totally new, and it was reported to us this morning on our Slack Community, and it’s something we’ve never seen before. So I’ll be investigating it ASAP.

Apart from that actual problem, I’d kindly ask you to try creating a new project, and please follow the instructions for the actual project template you’re creating, in your case it’s https://docs.webiny.com/docs/get-started/template-setup/cwp-template-cms.

Don’t even start the Going Live article until you have your local React apps installed and running successfully with a local instance of API. Let’s focus on getting that working correctly first.

Let us know how it goes, please join the Slack Community for faster communication. As for the Security problem during installation I’ll update you when I actually manage to replicate it and figure out what’s going on there.

Thanks for your time and see you around!