Hi, I am getting following error, is this a bug or...
# python
Hi, I am getting following error, is this a bug or am I missing something ?
error: Exception calling application: Object of type Unknown is not JSON serializable
The code I have is this:
The initial pulumi up successfully provisions everything but when I introduce a change into user_data1 string, the second pulumi up run fails with that error
looks like pumuli has some trouble diffing stuff when the apply callback is used
I believe you have to base64 encode the user data inside of the callback like
Copy code
user_data_rendered_bytes = user_data_rendered.encode("utf-8")
            user_data_rendered_b64 = base64.b64encode(user_data_rendered_bytes).decode(
so in your example, assuming you imported base64 lib somewhere in scope, you can do that
lambda x: base64.b64encode(user_data1.format(x).encode("utf-8"))
actually nevermind, I was looking at the LaunchTemplate resource and it needs pre-encoded user_data, the Instance() resource is supposed to do that for you. However, it might be tripping up because it's an Output[t]
I probably found an error and it seems it was related to something else. Sorry for confusion
No worries. I've had that happen a lot. Mind sharing what it ended up being if it's not too complicated?
I was passing that instance into my own dynamic provider. There in the diff function I was serializing inputs naively to json for comparison purposes and it failed because it tried to serialize Unknow type (from input that hasn't been resolved yet at that phase)
aye! makes sense. Yeah the promises/futures and the Output/Input stuff still gets me a lot. I don't have a super strong async programming background so I get stuck on that stuff. I definitely found patterns when pulumi spits back errors like that, gives me a
<pulumi.Output at 0xabcdefgs>
string or refers to "Unknown" type that it's probably an issue in not doing the right callback first.
I understand the Output/Input quite well I think and it makes sense to me. In this case I was just doing a silly thing (mostly because I copy pasted the diff code from somewhere else 😁)