Custom Query JSON Error on Execute for Schema

  1. The packages are exactly the same as before upgrading to 4.7.0.
  2. The queries run perfectly fine on:
    a. DataGrip
    b. SQL Workbench
    c. VSCode

I might add that none of this is happening in the browser or a custom module. It’s happening on ALL custom queries in the Custon Query Editor. See below:

Thus, I can only conclude that there is something wrong in Wappler.

The query in your example is returning hierarchical json data. Are you getting the same error as on top?

Custom queries expect to have a tabular return data not hierarchical.

For such nested json structures you might want to try the new sub tables and nested queries.

Hi George,

Yes, I get the same error. With the query you’re referring to, it has been working for the last 3-4 months and outputs the below.


AND

Well it seems there is a problem in executing the query in your database.

Where is your database located?

If you enable the debug in Server Connect Global options, you should be able to see more info.

Check the web server and database logs in Wappler:

image

Hey George,

So sorry for the late reply, been a very busy week for me. I’m not sure why it would be a problem executing in my database when the actual app still runs the custom queries without issue, and DataGrip executes the queries without problem either.

The only thing I can see from my logs are that it cannot find a login cookie when running the query, thus the restrict kicks in. webserver-log.zip (4.1 KB)

Below are the same two queries run in Wappler and DataGrip.
image

image

1 Like

The same problem occurs to me. Using customized queries results in the same error. Even basic queries do not work. Help me

Are you sure your issue is not the same as here:

If not - please provide some more details about the project, database, hosting type etc.

Custom queries that were previously successful do not work now. This is a different problem from the link you showed me.

So please post a new topic with more detailed explanation. “Custom queries do not work” is not really a helpful report of the issue.

It’s a very similar error to this topic, but I created a new topic.

What mikkime23 and I have in common is that we used the json_object method (json_build_object in postgresql). It works well until run a custom query that contains that method, but all custom queries do not work after the query that contains the thawing method fails.

I use a translator because I can’t speak English. Please understand even if it’s awkward.

Hey all,

Are custom queries still nerfed? I’m trying to do a simple query with a custom sort.

Currently on 5.0.2


I’m trying the below queries and I keep getting the same error.

image

Even doing SELECT * FROM guardians gives me the same error.

Below are the logs:

[2022-08-17 23:23:22.650] START inspectConnectionFile, fileName=db, siteName=undefined, target=undefined
[2022-08-17 23:23:22.663] OPEN popup: PopupWindow_1660742602661
[2022-08-17 23:23:22.663] save window state, type=databaseCustomQuery
[2022-08-17 23:23:22.661] CALL NW window: file:///C:/Users/micha/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/commands/dmxDatabaseCustomQuery.htm?theme=dark&app=true&noinit=true
[2022-08-17 23:23:22.685] got child state: 1
[2022-08-17 23:23:22.651] inspect=file:///C:/Users/micha/Documents/Wappler/SSA-CRM/app/modules/connections/db.json
[2022-08-17 23:23:22.932] NW PRELOAD script ....
[2022-08-17 23:23:22.658] START inspectConnectionFile, fileName=db, siteName=undefined, target=undefined
[2022-08-17 23:23:22.933] IS_BETA=false
[2022-08-17 23:23:23.088] initUI - Database Custom Query
[2022-08-17 23:23:22.659] inspect=file:///C:/Users/micha/Documents/Wappler/SSA-CRM/app/modules/connections/db.json
[2022-08-17 23:23:23.088] args= {
  property: {
    name: 'defineQuery',
    optionName: 'sql',
    title: 'Build Query',
    type: 'button',
    required: true,
    command: 'dmxDatabaseCustomQuery',
    commandNameParameter: 'databaseAction',
    dialogTitle: 'Database Custom Query',
    dialogType: 'databaseCustomQuery',
    dialogWidth: 950,
    dialogHeight: 600,
    value: '',
    actionType: 'dbcustom_query',
    actionData: {
      name: 'custom',
      module: 'dbupdater',
      action: 'custom',
      options: [Object],
      output: true
    },
    allValues: [],
    _fieldName: 'defineQuery'
  },
  serverType: 'node',
  dialogTitle: 'Database Custom Query',
  dialogType: 'databaseCustomQuery',
  dialogWidth: 950,
  dialogHeight: 600,
  data: {
    actionList: { settings: [Object], meta: [Object], exec: [Object] },
    basePath: '',
    isParentRepeat: null,
    serverType: 'node'
  },
  action: 'new'
}
[2022-08-17 23:23:23.090] START inspectConnectionFile, fileName=db, siteName=undefined, target=undefined
[2022-08-17 23:23:23.091] inspect=file:///C:/Users/micha/Documents/Wappler/SSA-CRM/app/modules/connections/db.json
[2022-08-17 23:23:23.092] initLayout
[2022-08-17 23:23:23.186] START getConnectionSchema ...
[2022-08-17 23:23:31.333] SAVE CUSTOM QUERY filepath: @@currentProjectRoot@@/app/api/__exec_query.json
[2022-08-17 23:23:32.052] try again ...
[2022-08-17 23:23:32.403] try again ...
[2022-08-17 23:23:32.771] try again ...
[2022-08-17 23:23:33.136] try again ...
[2022-08-17 23:23:33.500] try again ...
[2022-08-17 23:23:33.858] try again ...
[2022-08-17 23:23:34.233] try again ...
[2022-08-17 23:23:34.612] try again ...
[2022-08-17 23:23:34.971] try again ...
[2022-08-17 23:23:35.343] try again ...
[2022-08-17 23:23:35.400] didn't complete in 10 times ...
[2022-08-17 23:24:31.612] SAVE CUSTOM QUERY filepath: @@currentProjectRoot@@/app/api/__exec_query.json
[2022-08-17 23:24:32.284] try again ...
[2022-08-17 23:24:32.643] try again ...
[2022-08-17 23:24:33.002] try again ...
[2022-08-17 23:24:33.359] try again ...
[2022-08-17 23:24:33.716] try again ...
[2022-08-17 23:24:34.102] try again ...
[2022-08-17 23:24:34.461] try again ...
[2022-08-17 23:24:34.834] try again ...
[2022-08-17 23:24:35.205] try again ...
[2022-08-17 23:24:35.563] try again ...
[2022-08-17 23:24:35.636] didn't complete in 10 times ...

Cheers
Michael

I’m going to bump this. Still same error.

With the new custom query stuff in 5.1.5, I was hoping this would be fixed, however, still getting the same issue. I haven’t been able to use custom queries for months.

I think you have a very different problem. Seems like the generated server connect API call for the database test is just unavailable and can not be run. Or it takes too long time to run. This can be because each time the nodejs server running in docker has to be restarted to load the new query.

So if you have a large site it might take much longer.

Anyway we will be implementing new ways of executing database queries more directly to the database and not like now through the web server.

So hope this will be soon improved.

I can confirm that this has now been fixed! Thank you so much!

Fixed in Wappler 5.2.0