Connecting to new, prod mysql8 db - connection timeout (Workbench connects perfectly)

Hi all,

Any guidance on how to debug this? I’ve had no issues in the past - and I was able to connect to a postgres prod db just fine - but when using the mysql as my main db (e.g. what you set on target) - it won’t connect.

I can connect fine via MySql Workbench.

The db.json file for the relevant target, whenever I save the target it reverts the host to the docker machine (Remote) ip address, instead of using the AWS MySql endpoint URL - I’m not sure why it keeps doing that. Even if I place the mysql endpoint directly in the db.json file, still no luck…

Any ideas what I can do here?

Well this is frustrating.

If I change the connection settings in server connect ( as it is the default, as per target) then it ‘appears’ correct in the db.json file. However it doesn’t connect.

Then the minute I go back to my target and save the target (why does it have root password btw?) - it then changes all of the connection settings in the db.json file, and replaces the aws endpoint with the docker machine host.

@George / @Teodor - if with a Docker Machine/Node project - in target settings, if I am using a managed RDS DB - do I NOT include the Database informaton in the Target settings? Is that what i’m doing wrong, or, even with a Docker setup - I include my MySql Remote DB settings in the DB section of the prod target?

Screen Shot 2021-04-23 at 7.26.35 pm

If you use a docker db for the local database but different non docker db connection for remote, you just need to enters its credentials in the database manager and server connect for that target.

So just go to the “db” connection in server connect, switch to your production target and then enter its credentials and save. There is an option in the connection setting to use the same for the database manager direct connection. So check it or otherwise you will have to define it in the database manager as well.

Thanks for the reply. I’ve done all of the above - but it seems the target settings overwrites. I just cannot connect. I’m using workbench and it connects no issue, but when using Wappler it keeps reverting the connection url to the docker Remote IP address.

Which db connection settings are not saved for your production target the server connect ones or the database manager?

Those are just save in .wappler/targets/xxx folder and used when you switch targets, so verify there.

Server connect shows the correct settings in the json file but the dB.json file in the correct target folder gets overwritten by the Docker host url.

I’ve even edited this as well as the server connect file manually. I just get a timeout.

I tried removing the dB connection from the target too. No luck. Then I test in workbench same credentials - connects instantly.

Where exactly do you get a timeout and what target is selected?

Target selected was production (with the remote dB).

I get a timeout little red icon on the dB connection in dB manager.

Note - I have a second remote dB that connects just fine on that target - it’s only the ‘dB’ that is having issues - I suspect something to do with it being the main dB/dB in the target settings?

@George I’m going to try again today, I’ve deleted the previous prod target attempt - and this time I’ll try and set up with the same docker machine, but this time choosing ‘None’ as the DB in target when setting up.

Noting, I’ve done this and I receive this error in the console prior to attempting to do anything, this happens right after creation of the target:

File /Applications/Wappler.app/Contents/Resources/app.nw/Shared/DMXzone/Databases/Connections/node/dmxDatabase.json does not exists!

I have gone to the ‘db’ in server connect and input the correct DB information (verified by Workbench connecting instantly). I then save.

Note:

I don’t see this anywhere. Please screenshot where this exists. I’ve checked settings for the DB / Databases in Server Connect - I have no checkbox option for this. (I’m on latest Wappler). In DB Manager - I am unable to view the Direct Database Connection as it presents the Wappler error "This is a default database connetion defined in Docker, to edit it use the project target settings.’

When I click on this, or whenever I try to refresh the DB connection in DB Manager I keep getting this error:

File /Applications/Wappler.app/Contents/Resources/app.nw/Shared/DMXzone/Databases/Connections/node/dmxDatabase.json does not exists!

So even on a new target, with ‘None’ selected when setting up the target I am getting the same error.

And now the error when I hover over the little red icon in the ‘db’ connection in DB Manager is: Invalid Target Configuration. Check your web server URL and your configuration to it.

For the target I’ve used a correctly setup Docker Machine created from within Wappler.

Can you advise what I need to do next to get this up and running? We essentially cannot go to prod with this issue…

Thanks @Teodor - can you advise how I open this Database Connection modal?

I don’t have the option to do so - unless I’m completely missing it.

I’m in Server Connect (Now workflows) - if I click on the folder, I have no options available other than the settings cog - which just opens the generic SC settings. Then at the bottom of the left panel I have Connection Options but that opens up the previous panel - nothing like what you are showing me there.

I’m on the latest version of Wappler and this is a NodeJS project.

For NodeJS the connection is automatically created under Database Manager, so this checkbox is not available there.

Got it.

So what else can I look at or provide to you? I’ve tried creating the target 3 times now, with various approaches. None will connect to MySql Remote as the default DB, whereas Workbench does just fine with the exact same credentials.

Guys,

I’ve just tried again.

This time:

  1. New Target with the previously created Docker Machine. Remote set.
  2. In DB Settings, I included all AWS RDS MySql settings - as per a successfull connection with Workbench.
  3. Confirm creation of target.
  4. I’m currently in ‘development’ target, so I now click on the newly created production target - and notice the color circle is red (which I believe is correct, as it won’t auto-deploy to prod anymore).
  5. So I go to ‘db’ in Server Connect - and the ‘host’ has been overwritten by ‘db’ instead of the AWS RDS endpoint.
  6. I leave this, and go to DB Manager - again I see this:

Screen Shot 2021-04-27 at 6.11.27 pm

  1. So, I go back to Server Connect and click on DB then Connection Settings and input the endpoint again.
  2. I then go back to DB Manager to view the tables, I refresh and I’m again left with the same red icon and connect ETIMEDOUT.

I’ve double checked my access policy in AWS for the DB, I’ve even created an entirely new security group with access policy and re-added the appropriate IPs.

I’ve tested connecting with Workbench again after the aforementioned access updates - Workbench connects instantly.

Still I get timeout in Wappler.

I’ve checked the Server Connect db connection, the json file looks correct.
Then when I go to the db.json file in the target folder - it’s reverted again back to the docker machines host ip and user as ‘root’ and passsword’ as the one provided by the machine creation.

I suspect the issue is to do with the default db creation and using a remote db, as creating a secondary remote db connection works seamlessly.

Guys, I don’t know what else I can provide you to solve this. Please advise.

Just make sure you:

  1. first select the remote target and make it active,
  2. then select the db connection in server connect and edit it.
  3. then edit the db connection in the database manager - and test it.

When saved you should be able to refresh and see your remote database schema.

@George

I’ve done what you have suggested, for each 4 attempts and I’ve written as much throughout this post ​- it’s not working. I don’t have the option to ‘test’ the connection in DB Manager as I have a node project, and as it’s the default connection it just alerts me to only edit this in the target settings.

I would prefer this to be a simple user-error on my behalf, because then it’s a quick fix - I’m providing as much information to the Wappler team as possible to help debug/overcome whatever I’ve not done.

Hi @mgaussie,
If you haven’t spotted it already, there is a separate set of connection settings in Database Manager

The ‘db’ connection is a Wappler managed one and is seemingly overwritten any time you save the project settings. If connecting to RDS, I would suggest creating a new connection entirely for that target.

I have connected fine with this and can use DB Manager with RDS

Thanks for this @bpj.

I have a secondary dB connection which is remote and like you connect to this fine.

I have two other, older projects and I use db for local, staged (remote) and prod (remote).

All work fine.

I appreciate what you are saying but the suggestion basically means I will not be able to use the default DB connection in any of my projects, as I’ll always use a remote dB for production.

The default dB then becomes redundant in Wappler.

Most who are genuinely looking to scale out a production app will likely use a remote /managed remote dB.

I do appreciate your willingness to reply @bpj

1 Like

Agreed.

I don’t think it’s a bug per se but it is definitely something that could be refined a little.