I am currently in the process of setting up a simple workflow in Retool using Python to connect to a third-party service via the Fireblocks SDK. The issue I’m encountering is a parsing error with the public key, as indicated by the error message:
InvalidKeyError: Could not parse the provided public key.
Interestingly, this exact code works flawlessly when executed in my local Jupyter notebook environment. I have attached a screenshot of the error message for your reference.
Given that the code itself seems to be correct, I suspect the issue might be specific to the Retool environment or its handling of the public key. Could you please advise on how to troubleshoot or debug this issue further within Retool? Are there any environment-specific configurations or additional steps I should take to ensure the key is correctly parsed?
Thank you in advance for your assistance. I’m looking forward to your guidance on resolving this issue.
Does anything show up in your log when you try to print() the API key? Where is FIREBLOCKS_API_KEY defined? Do you mean to reference retoolContext.configVars.FIREBLOCKS_API_KEY (a stored configuration variable)?
Hi, yes in the debug log console, the api key appears when i run the function to print the api key. In any case i also try to send api key directly as text but same issue is faced
Same code on jupyternotebook works
And FIREBLOCKS_API_KEY defined in the environment variable script of retool
its a very simple instruction i dont understand why it doesnt work. but again works fine on my jupyter notebook
how can i debug in more details this issue of public key ?
i've tried different approach to authenticate but it seems the error comes from a bug on retool side, as the same code works fine on jupyter notebook but not on retool workflow i ve managed to drill down the problem into this code below: even though it doesnt authenticate, it shoots back the error : InvalidKeyError: Could not parse the provided public key.
I think I was able to figure out what's going on here; as you suspected, the root of the issue is the encoding of the JWT token. Given the fact that the Fireblocks SDK encodes its JWT using the RS256 algorithm, it's super important that FIREBLOCKS_API_SECRET be very specifically formatted.
As it turns out, Retool isn't reading the multi-line string correctly. I was able to get it working by formatting the FIREBLOCKS_API_SECRET constant as a single line with new line (\n) characters!
I'll bring this to the attention of our team and pass on any updates but hopefully you can move forward now!