Database Single Query not returning correct record NodeJS

Hi, Can someone spot what I am doing wrong with the most basic of DB queries in a NodeJS project?

I have two queries;

Single Record Query

Where

Results as expected

Custom Query

Result as expected

However, when I publish and load the page I get the following

{"DB_Single_Query":{"LogID":1,"ErrorDateTime":"2024-04-02T13:30:49.243Z","ErrorMessage":"Failed to get response text.","ErrorProcedure":"sp_VisionNet_RetriveCompanyFullReport","ErrorLine":34},"BD_Custom_Query":[{"LogID":4,"ErrorDateTime":"2024-04-02T13:38:11.740Z","ErrorMessage":"Failed to get response text.","ErrorProcedure":"sp_VisionNet_RetriveCompanyFullReport","ErrorLine":38}]}

The custom query returns the correct record as expected. However, the Single Query is consistently returning the first record in the table instead.

I’ve also created a new Server Action to rule out any configuration issues, but the result is the same.

Am I missing something fundamental here? I’ve built multiple ASP projects in Wappler and haven’t encountered this behaviour before.

I am running Wappler 7.7.6 and this is my first NodeJS project, so maybe I am doing something fundamentally wrong or this is a bug. If this is fixed in a later version, please ignore.

Thanks
Ray

Just tested the same and it works both inside Wappler and when running the server action in the browser.
What database are you using?
Can you enable debug option for the query step, run the server action and post the generated code?

Hi Teodor,

I am using SQL Server 2019.

Here’s the debug output for the single query;

{"DB_Single_Query":{"options":{"connection":"PaymentPlus","sql":{"type":"first","columns":\[{"table":"dbo.APIErrorLog","column":"LogID"},{"table":"dbo.APIErrorLog","column":"ErrorDateTime"},{"table":"dbo.APIErrorLog","column":"ErrorMessage"},{"table":"dbo.APIErrorLog","column":"ErrorProcedure"},{"table":"dbo.APIErrorLog","column":"ErrorLine"}\],"params":\[\],"table":{"name":"dbo.APIErrorLog"},"primary":"LogID","joins":\[\],"query":"select \[LogID\], \[ErrorDateTime\], \[ErrorMessage\], \[ErrorProcedure\], \[ErrorLine\] from \[dbo\].\[APIErrorLog\] where \[dbo\].\[APIErrorLog\].\[LogID\] = @p0","sort":null,"dir":"asc"},"test":true},"query":{"sql":"select top (@p0) \[LogID\], \[ErrorDateTime\], \[ErrorMessage\], \[ErrorProcedure\], \[ErrorLine\] from \[dbo\].\[APIErrorLog\]","bindings":\[1\]}}} 

Enabling debug on the custom step does not seem to include any additional information

{"BD_Custom_Query":\[{"LogID":4,"ErrorDateTime":"2024-04-02T13:38:11.740Z","ErrorMessage":"Failed to get response text.","ErrorProcedure":"sp_VisionNet_RetriveCompanyFullReport","ErrorLine":38}\]}

Thanks
Ray

Hi Raymond,

Are you running the project in a Docker environment?