Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Toolpad breaks the app in https://github.com/mui/mui-private/tree/master/tools-private #2934

Closed
oliviertassinari opened this issue Nov 24, 2023 · 3 comments
Labels
regression A bug, but worse

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 24, 2023

Steps to reproduce 🕹

Steps:

  1. Go to https://github.com/mui/mui-private/tree/master/tools-private
  2. Update Toolpad from 0.1.24 to 0.1.38
  3. See how http://localhost:3000/_toolpad/app/pages/f303n5n is broken
  • The date displayed is wrong
  • Queries can't be added anymore, on a new page, it shows 500
@oliviertassinari oliviertassinari added status: waiting for maintainer These issues haven't been looked at yet by a maintainer regression A bug, but worse labels Nov 24, 2023
@Janpot
Copy link
Member

Janpot commented Nov 24, 2023

  • The Date object bug was introduced in 0.1.28 => Date objects aren't transferred from the server to the client. Looks like right now it can only transfer JSON.

  • The 500 was introduced in 0.1.34: Running with NODE_OPTIONS="--enable-source-maps --stack-trace-limit=1000" to get proper stack traces gives me:

    Error: Detected property constructor. This is a prototype pollution risk, please remove it from your object.
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:224:13)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:229:29)
        at <anonymous> (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:52)
        at Array.forEach (<anonymous>)
        at forEach (~/mui-private/tools-private/node_modules/node_modules/superjson/src/util.ts:45:26)
        at walker (~/mui-private/tools-private/node_modules/node_modules/superjson/src/plainer.ts:218:3)
        at SuperJSON2.SuperJSON2.serialize (~/mui-private/tools-private/node_modules/node_modules/superjson/src/index.ts:35:20)
        at SuperJSON2.SuperJSON2.stringify (~/mui-private/tools-private/node_modules/node_modules/superjson/src/index.ts:81:32)
        at <anonymous> (~/mui-private/tools-private/node_modules/@mui/toolpad/src/server/rpc.ts:87:31)
    
    

    Looks to be around the same area, in serialization/deserialization.

Will investigate further

@Janpot
Copy link
Member

Janpot commented Nov 27, 2023

Ok, for the 500 we are having trouble transferring the typescript interface that describes the MySQL result. it contains a "constructor" property. This is new behavior in superjson. Very unnecessary

I don't immediately have a way to fix this besides reverting the update or writing our own smart serialization logic. I'm opening some issues in the hope thatw e can fix this without dropping a serialization library:

@Janpot Janpot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 27, 2023
@Janpot
Copy link
Member

Janpot commented Nov 27, 2023

Fixes in:

@Janpot Janpot closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression A bug, but worse
Projects
None yet
Development

No branches or pull requests

2 participants