Database settings, targets, publishing... how?!

Newbie again.
I searched a lot of the forums, but I don’t get it:

The challenge:

  • Local Development, local database
  • Remote Server, different database (in this case Railway, but it doesn’t matter)

What exactly do I have to do to get my project published (to an external folder_ with different database settings for production?

The docs and the forum are not a great help for a beginner, as they refer to different versions and features who work / behave differently.

What I tried:

  1. First and obvious: I entered the DB details on a new target. After publishing to the local folder, still localhost in the connections.
  2. Went to the database manager, added a new database connection (was recommended somewhere, didn’t understand exactly what it does, but hey: I could connect to my remote database from within the database manager. Btw, after deleting them, I get tons of error messages in the logm see below *1 )
  3. Found a how to and a video somewhere where I can switch between my targets (bottom right of the window) and enter different settings. Seems legit, but no: under connection propertiesconnection options the last entered dabase settings are visible → doesn’t work for me?
    Edit: Define Database Connection Settings per Target
  4. Next try: Database Manager, selected my database, pressed Direct Database Connect and entered my details (e.g. localhost), then switched to my other target and I could enter new connections setting who are switching. However, it doesn’t change the database settings for the published project.

*1 Error from the console when switching targets:

TypeError: Cannot read properties of undefined (reading 'type') at r.delete (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:108014) at Object._execute (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/jsTree/jstree.contextmenu_fontawesome.js:8:4351) at HTMLAnchorElement.<anonymous> (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/jsTree/jstree.contextmenu_fontawesome.js:8:11516) at HTMLUListElement.dispatch (/Applications/Wappler.app/Contents/Resources/app/node_modules/jquery/dist/jquery.js:5430:27) at HTMLUListElement.elemData.handle (/Applications/Wappler.app/Contents/Resources/app/node_modules/jquery/dist/jquery.js:5234:28) at HTMLUListElement.sentryWrapped (/Applications/Wappler.app/Contents/Resources/app/node_modules/@sentry/browser/dist/helpers.js:75:23)
TypeError: Cannot read properties of undefined (reading 'type') at r.delete (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:108014) at Object._execute (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/jsTree/jstree.contextmenu_fontawesome.js:8:4351) at HTMLAnchorElement.<anonymous> (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/jsTree/jstree.contextmenu_fontawesome.js:8:11516) at HTMLUListElement.dispatch (/Applications/Wappler.app/Contents/Resources/app/node_modules/jquery/dist/jquery.js:5430:27) at HTMLUListElement.elemData.handle (/Applications/Wappler.app/Contents/Resources/app/node_modules/jquery/dist/jquery.js:5234:28) at HTMLUListElement.sentryWrapped (/Applications/Wappler.app/Contents/Resources/app/node_modules/@sentry/browser/dist/helpers.js:75:23)
TypeError: Cannot read properties of null (reading 'data') at refreshSchemaForNode (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:163294) at HTMLButtonElement.<anonymous> (file:///Applications/Wappler.app/Contents/Resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:45179) at HTMLButtonElement.dispatch (/Applications/Wappler.app/Contents/Resources/app/node_modules/jquery/dist/jquery.js:5430:27) at HTMLButtonElement.elemData.handle (/Applications/Wappler.app/Contents/Resources/app/node_modules/jquery/dist/jquery.js:5234:28) at HTMLButtonElement.sentryWrapped (/Applications/Wappler.app/Contents/Resources/app/node_modules/@sentry/browser/dist/helpers.js:75:23)

These videos @ben made might be of help.


1 Like

Okay, I think I found it: I have to quit Wappler each time I change the enviroment to get it properly loaded. Then it seems to work.

Thanks, Eric. @ben is always a good source of help, but my use case is a differnt and not Railway related.

How do you change environment ? Environment is usually per process, so it works only the in process you change it. Or if it is global then it will be applied only when a new process is started (so Wappler restart indeed)

I am pretty sure I just do something fundementally wrong, guessing my way :see_no_evil:

But it looks like that edting the database options per Target required a new start of Wappler. After I added all database settings (tried a couple of times now) and quit Wappler after each editing, they are stored now.

When I change the Target on the Publish Dialog, it seems to write the correct database settings into /app/modules/connections/...json

Is this actually the correct process to set it up?

Local Development settings:

Switching to another Target, no changes in settings dialog:

Quitting Wappler and re-opening, data as expected

After I did this now for both enviroments, the publish process creates the correct files.

@HeikoK Hi!

I might know what the problem is.
When you open the database connection settings in “Workflows->Globals->DB Connections->dbconnection1”, you actually open the tab with settings only for this specific target.

So if you want to set different settings for another Target, you should close the tab first.

Because the opened tab will not be refreshed automatically when you change the current Target in the bottom panel.
It will look like you are seeing settings for current Target, but actually it would be for previous.

So, right way is:

  1. Open DB settings and set it.
  2. Close the tab.
  3. Switch current target.
  4. Open DB settings again and change it.
    etc.
2 Likes

Okay, I’ll give it a try next time.
(I am sure, I closed all tabs before opening them again :joy:)

A post was split to a new topic: Server Connect Database Connection in tab does not refresh when active target is changed

Confirmed: if you close the tab, switch target and open the target again, the settings are updated!

@George: Sorry for the mess, but it’s a bit confusing for someone, who doesn’t know Wappler (think of me as a Guinea Pig :see_no_evil::joy:

1 Like

No problem at all, a fresh look is always good! It helps us improve Wappler so it is crystal clear and smoothly working.

A post was split to a new topic: Errors when switching targets in the Database Manager

Keep it in this thread, but what’s this message about, @George?

Ignoring invalid configuration option passed to Connection: supportBigNumber. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection

Is displayed in the console with every database request

(Running MySQL 8)

Please post different things in separate topics, so we can track them better and I don’t have to split the topic each time :slight_smile:

Ooookay… didn’t want to make to much noise :slight_smile:

1 Like

Those errors will be solved in the next update

Fixed in Wappler 5.4.2

This topic was automatically closed after 32 hours. New replies are no longer allowed.