Error when executing `load_env`

Hi!

We are having a weird issue when dealing with load_env and the DSL format … It might just be me tho

$ echo $RECIPIENT
addr_test1qqr585tvlc7ylnqvz8pyqwauzrdu0mxag3m7q56grgmgu7sxu2hyfhlkwuxupa9d5085eunq2qywy7hvmvej456flknswgndm3

But when we execute

recipient_address = load_env(“RECIPIENT”);

We get test Is there any parsing we should be aware of?

In load_env, we feed the contents of the environment variable directly to a JSON parser (for use in the rest of a workflow). This allows the caller to provide arbitrarily complex JSON objects as environment variables but has the unfortunate side effect of requiring all environment variables to be in JSON format. To pass a string into load_env, you need to wrap it with quotes (otherwise it may try to parse it as a number or something):

export RECIPIENT=\"addr_test1qqr585tvlc7ylnqvz8pyqwauzrdu0mxag3m7q56grgmgu7sxu2hyfhlkwuxupa9d5085eunq2qywy7hvmvej456flknswgndm3\"

This leaves "addr_test1qqr585tvlc7ylnqvz8pyqwauzrdu0mxag3m7q56grgmgu7sxu2hyfhlkwuxupa9d5085eunq2qywy7hvmvej456flknswgndm3" in the environment variable instead of addr_test1qqr585tvlc7ylnqvz8pyqwauzrdu0mxag3m7q56grgmgu7sxu2hyfhlkwuxupa9d5085eunq2qywy7hvmvej456flknswgndm3.

Sorry for the confusion!

that was it! thanks @patrick.ogrady

1 Like