Atri-Labs / atrilabs-engine

πŸ§˜β€β™‚οΈ Open-source no-code & code web app builder
https://atrilabs.com
GNU General Public License v3.0
4.13k stars 182 forks source link

🐞 After updating to v0.0.72 Build & Run yields error #405

Closed mhered closed 2 years ago

mhered commented 2 years ago

Is there an existing issue for this?

Current Behavior

I created a simple app with one page a div and a table and pressed Build&Run. It fails with error: Some error has occured. We are very sorry for this. Please contact the Atri Labs team at their Slack channel for help.

Screenshots

Screenshot from 2022-10-16 10-26-29

Expected Behavior

The app should build & run in http://localhost:4005/

System configuration

1. OS: Ubuntu 20.04
2. Bits: 64b
3. Browser: Firefox
4. Atri framework version: 0.0.72
5. Virtual environment: pipenv

Steps To Reproduce

1. Follow process described in docs to [Update Atri](https://docs.atrilabs.com/existing-project/update-atri
2. Create a simple app with a div and a table
3. Press Build & Run

Anything else?

Before updating I was experiencing an error message similar to the one described in issue #396

welcome[bot] commented 2 years ago

Hello there!πŸ‘‹ Welcome to the project!πŸ’– Thank you for opening your very first issue here. Hope you have a great time here!πŸ˜„ Besides, don’t forget to ⭐ the repository, if you haven’t already!

cruxcode commented 2 years ago

Hi @mhered, thank you for raising such a detailed issue. I would like to get a few more details as I am unable to reproduce this issue on my end. I request you to follow these steps so that I can gather some more information to understand the root cause of the problem:

  1. Run atri start --debug to run atri editor in debug mode.
  2. Click Build & Run.
  3. Copy all the logs generated in the terminal and please send it here in the comments.

Again, we really appreciate the effort you are putting into it.

mhered commented 2 years ago

Below:

(calcount2) (base) mhered@mhered-laptop:~/hacktoberfest22/calcount2$ atri start --debug
Connecting to ipc server...
Please wait while we get the server ready...Connection to ipc server failed!
Please wait while we get the server ready...Connection to ipc server failed!
Please wait while we get the server ready...App is running...
Please wait while we get the server ready...Connection to ipc server failed!
Please wait while we get the server ready...Connection to ipc server failed!
Please wait while we get the server ready...Connection to ipc server failed!
Please wait while we get the server ready...[manifest_server] listening on http://:::4003
Please wait while we get the server ready...Connection to ipc server failed!
[publish_app_server] listening on http://:::4004
Please wait while we get the server ready...[ipc_server] listening on http://:::4006
[file-server] listening on http://0.0.0.0:4002

Success! Visit http://localhost:4002 to access the editor.
[websocket_server] listening on http://:::4001
Connected to ipc server!
[publish_app_server] connected to ipc server
[ipc_server] client registered: atri-cli
Registered as atri-cli with ipc server.
[ipc_server] client registered: publish-server
[publish_app_server] registered to ipc server
[PUBLISH_SERVER] Socket connected X9hG-n0oXBAc56DSAAAB
[websocket-server] Following error occured in fetchEvents message handler
TypeError: Cannot read properties of undefined (reading 'state')
    at /snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:131:64
    at Array.forEach (<anonymous>)
    at handleEvent (/snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:130:40)
    at /snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:217:13
    at Array.forEach (<anonymous>)
    at Object.handleEvents (/snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:216:16)
    at compressEvents (/snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/compression.js:24:12)
    at Socket.<anonymous> (/snapshot/webapp-builder/node_modules/@atrilabs/server-client/lib/websocket/server.js:269:68)
    at Socket.emit (node:events:527:28)
    at Socket.emitUntyped (/snapshot/webapp-builder/node_modules/socket.io/dist/typed-events.js:69:22)
[PUBLISH_SERVER]runTasks received
[publish_app_server] generate app called
/snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:131
                var parentId = treeMap[treeId_3].nodes[nodeId].state.parent.id;
                                                               ^

TypeError: Cannot read properties of undefined (reading 'state')
    at /snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:131:64
    at Array.forEach (<anonymous>)
    at handleEvent (/snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:130:40)
    at /snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:217:13
    at Array.forEach (<anonymous>)
    at Object.handleEvents (/snapshot/webapp-builder/node_modules/@atrilabs/forest/lib/forest.js:216:16)
    at /snapshot/webapp-builder/node_modules/@atrilabs/app-generator/lib/gen-script/index.js:102:51
    at Array.forEach (<anonymous>)
    at /snapshot/webapp-builder/node_modules/@atrilabs/app-generator/lib/gen-script/index.js:101:32
    at Array.forEach (<anonymous>)
[server-utils] generateApp received code 1
task queue callback called for task generate failed
darshitac11 commented 2 years ago

Thanks @mhered. We are looking into it and will get back to you soon.

cruxcode commented 2 years ago

Hi @mhered. I was not able to reproduce the issue on my end. It would be a great help if you can push your project to GitHub?

mhered commented 2 years ago

Done, you can check it out here: https://github.com/mhered/calcount2

mhered commented 2 years ago

As mentioned it is almost empty, only has a page with a div and a table, and no backend

cruxcode commented 2 years ago

@mhered Thanks for sharing your repo with us. I was able to figure out the issue. It seems you had two instances of Atri Editor running parallelly in the browser for two different projects. The events from one project have seeped into another, hence, the state of the app cannot be computed. In the next version, we are going to add guards that would prevent this from happening. Thanks for sharing your repository. It was very helpful in figuring out the root cause of the issue.