MYSQL query that returns empty table results in error screen

I have a query configured in my app that currently should return an empty table because I haven’t entered any data that meets the query’s requirements yet.

SELECT name as "name", id as "id"
FROM events
WHERE travelogue = 1
ORDER BY id DESC;

When I try to run the query, I get this error screen.

Running this same query in MYSQL Workbench is successful and properly returns an empty table. Adding a row to the table that meets the query’s requirements prevents the error message on Appsmith.

Is this a bug?

@trebuchet

So this issue happens when you click the Run button in your query? Do you get any errors in the browser console?
Are you on cloud or self-hosted?

Hi @Amelia - this is self-hosted. Here is the error I get in the console. Sometimes I can go back on the browser to the edit page and it won’t happen again until I hit Run. Other times if I try going back, it will cycle through the error again and if I want to ‘fix’ it I manually edit the database to make sure the query doesn’t return an empty table.

main.b104d99d.chunk.js:1 {error: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at htt…, errorInfo: {…}}error: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at https://home-db.tvslab/static/js/main.b104d99d.chunk.js:1:2758289
    at Object.useMemo (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4757425)
    at t.useMemo (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4693946)
    at https://home-db.tvslab/static/js/main.b104d99d.chunk.js:1:2758242
    at $a (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4752531)
    at Es (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4798761)
    at vc (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4791488)
    at mc (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4791413)
    at sc (https://home-db.tvslab/static/js/14.c0e4d666.chunk.js:2:4788422)errorInfo: {componentStack: '\n    in Unknown\n    in WithTheme(Component)\n    in…OE\n    in Connect(OE)\n    in f\n    in t\n    in yE'}[[Prototype]]: Object
componentDidCatch @ main.b104d99d.chunk.js:1

@trebuchet which version of Appsmith are you on? Can you also add a limit to your query? That might be causing the app to crash with a large dataset

I’m also experiencing the same issue with postgres. This wasn’t the case prior to version 1.7.2. I’m using the self-hosted version.

Did you find a solution? This is also happening with postgres. It was Ok before the upgrade to version 1.7.2

I am on v1.7.2 also. @Nikhil - my dataset is only 5 rows currently and it is still causing it.

Hi there!
@trebuchet , @kabugyei

Sorry you’re facing this problem! I tried unsuccessfully to replicate this issue. Please let me know if we can do a quick debug, and I’ll send the zoom link.

Thanks!
Rohan

@kabugyei @trebuchet it would be great if you could create an app on the cloud instance & invite support@appsmith.com to your app so we can debug it too

@trebuchet thank you for the zoom call. Please follow updates here [Bug]: App crashes when query returns 0 rows · Issue #14584 · appsmithorg/appsmith · GitHub