You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a Retool RPC endpoint that looks like this:
rpc.register({name: "function",arguments: {projectId: {type: "string",description: "A string input",required: false},},implementation: async(args,context)=>{console.log('args.projectId',args.projectId);},});
The problem is that Retool seems to be allowing passing of non string values via RPC. You can see how we are passing a variable here:
But this variable is nullable
Nothing in Retool indicates an issue and we can call the function with this value.
Also the retool rpc package doesn't seem to parse the values coming in, so now our types are wrong:
Which has resulted in some nasty runtime errors, partially defeating the purpose of using something like Retool RPC + Typescript.
To avoid any more issues of this nature I'm considering using zod to parse the arguments that come from Retool RPC, but this is cumbersome because it will require defining the types multiple times, once for retool and once for zod.
Doing some sort of parsing or validation either in the rpc package or in the retool dashboard would make this feature much safer to use.
The text was updated successfully, but these errors were encountered:
We have a Retool RPC endpoint that looks like this:
The problem is that Retool seems to be allowing passing of non string values via RPC. You can see how we are passing a variable here:
![image](https://private-user-images.githubusercontent.com/16123225/344822390-3501b6e3-5f87-4f7b-9201-ddb1744cad6a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUzNDA3NTcsIm5iZiI6MTcyNTM0MDQ1NywicGF0aCI6Ii8xNjEyMzIyNS8zNDQ4MjIzOTAtMzUwMWI2ZTMtNWY4Ny00ZjdiLTkyMDEtZGRiMTc0NGNhZDZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTAzVDA1MTQxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyYzdkMTJkMjdkZTUyOTM1MDFmYzk2NTRjZGQ4NDU2MTkxYzA5YWIxNTJmMzA0MjI5MTkzYTc5NDZjZmQzNzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FOt7MXofgDu1p51xoNE8LkiGS-Al75Bvf4Qng-1k_-g)
![image](https://private-user-images.githubusercontent.com/16123225/344822454-689544a5-b27e-47fa-99a2-cab0b5514520.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUzNDA3NTcsIm5iZiI6MTcyNTM0MDQ1NywicGF0aCI6Ii8xNjEyMzIyNS8zNDQ4MjI0NTQtNjg5NTQ0YTUtYjI3ZS00N2ZhLTk5YTItY2FiMGI1NTE0NTIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTAzVDA1MTQxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmMDY5NDg5ODFiMDE5M2ViMWVjNjFiOTg4NTE4MjFhOTkwY2VjOWZlNDcyNjAyNDNiYzhmN2I2YmI0NjRmZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FBRxaqZMjzkk8YbNYASoF0GgKQzaFs-KmHaE1GnMehI)
But this variable is nullable
Nothing in Retool indicates an issue and we can call the function with this value.
Also the retool rpc package doesn't seem to parse the values coming in, so now our types are wrong:
![image](https://private-user-images.githubusercontent.com/16123225/344822834-2dcb0841-27c6-4e6f-b91f-76ae48f62d16.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUzNDA3NTcsIm5iZiI6MTcyNTM0MDQ1NywicGF0aCI6Ii8xNjEyMzIyNS8zNDQ4MjI4MzQtMmRjYjA4NDEtMjdjNi00ZTZmLWI5MWYtNzZhZTQ4ZjYyZDE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTAzVDA1MTQxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkxMDA1Yjk0YjU0OTU1NGI1MzIxZDJmMGNmMTQ2ZGVhNTcxM2RmMTU1MTQ4ZWU2NWJmZDFjZDI3M2RiY2RhZjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.x3ljSldilwlP0NwSZ7wiuGAhJxvekjJcfpBsmxeaHjQ)
Which has resulted in some nasty runtime errors, partially defeating the purpose of using something like Retool RPC + Typescript.
To avoid any more issues of this nature I'm considering using
zod
to parse the arguments that come from Retool RPC, but this is cumbersome because it will require defining the types multiple times, once for retool and once for zod.Doing some sort of parsing or validation either in the rpc package or in the retool dashboard would make this feature much safer to use.
The text was updated successfully, but these errors were encountered: