Node.js multiple errors

I’m trying to get started building an application using node.js but can’t seem to even get a test page to work…

I’ve connected to the database and created a test query which I’ve added to the page using server connect (as per usual). I’ve just added a basic select menu using this as the data source but when I check the page in a browser I get the following error in the console…

{"status":"500","message":"A server error occured, to see the error enable the DEBUG flag."}

I’ve enabled debug but just get the same error telling me to turn on debug.

The code on the page looks like this…

I created another basic query and tried outputting that straight to a browser but just get the following…

{"status":"404","message":"/api/test not found."}

Turning on debug in the query properties makes no difference to this error.

Are these errors something to do with routing? I haven’t made any changes here but was under the impression the routing configuration “works out the box”…

2022-02-25_10-19-37

Any help much appreciated - I really want to start using node.js but tempted to just go back to PHP.

Thanks.

Have you re deployed your site since changing the setting?
Once debug is enabled you must view the output in the Network section of the browser developers console to see there error.

You will see the action in error there

Clicking on the action in error will display the actual error message

And note the debug option is in the server connect settings, not the one for the database query step!

From the code you show, the form is not set as a server connect form. Your form should have a syntax like this:

<form id="login1" is="dmx-serverconnect-form" method="post" action="../dmxConnect/api/admin/login.php" 

YIOu set it here.

Thanks for all the quick responses…

I have already turned on debug in the server connect settings and also am looking at the Network section…

2022-02-25_11-08-01

I’ve changed the form to a server connect form (I forgot about that) but it makes no difference.

As I said, when I output a very basic query to the browser I get the following…

{"status":"404","message":"/api/test not found."}

This would usually work on a PHP site.

I just restarted the server which seems to have resolved the debug issue.

I’m now getting…
“status”:“500”,“code”:“ER_ACCESS_DENIED_ERROR”,“message”:"ER_ACCESS_DENIED_ERROR: Access denied for user

However, my credentials are correct…

image

I can see all the tables and create queries etc.

The dialogue you posted are from the direct settings used only by the database manager. Have you checked the settings in the global s section of workflows?

Ah ha! I see what’s been happening. When I first set this up I made a typo in the password (in the database connection in globals). When you save the connection settings there’s no indication that the json file also needs saving…

Here’s an example - I change the password here and hit save…

I assumed the associated file was saved as there’s no blue indicator as there is for other files to show that it needs saving again. If I hit Ctrl+S it saves the file and now it works.

image

Maybe when you change connection settings under Globals and select Save it should save the file automatically without the need to save the file again…or at least show the little blue indicator to show the file needs saving.

Anyway, thanks for helping me find the issue…I thought it would probably be something simple!

@George This is what I was getting at here:

1 Like

Working now?

1 Like

Yes, thank you!