https://pulumi.com logo
#general
Title
# general
f

fast-activity-86095

04/27/2020, 10:37 PM
👋 New to Pulumi and so far so good. Something that's tripping me up is that I can't seem to get 2 stacks to work together that have a different runtime. I have a typescript stack that's outputting an image:
Copy code
(venv) ~/***/pulumi/projects/images/config $ pulumi stack output image
***.<http://dkr.ecr.us-east-1.amazonaws.com/jdrake/***-59fb83d:602e111c06b6934013578ad80554a074049c59441d9bcd963cb4a7feccede7a5|dkr.ecr.us-east-1.amazonaws.com/jdrake/***-59fb83d:602e111c06b6934013578ad80554a074049c59441d9bcd963cb4a7feccede7a5>
and then a python stack that's trying to import it then pass it to a Component:
Copy code
env = pulumi.get_stack()
image_stack = pulumi.StackReference(f"jdrake/***-image-config/{env}")
image = image_stack.get_output("image")
service = Service("***", env, image, port=80)
However, running
pulumi up
gives me:
Copy code
error: Program failed with an unhandled exception:
    error: Traceback (most recent call last):
      File "/usr/local/bin/pulumi-language-python-exec", line 85, in <module>
        loop.run_until_complete(coro)
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
        return future.result()
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/asyncio/tasks.py", line 180, in _step
        result = coro.send(None)
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 81, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 34, in run_pulumi_func
        func()
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 81, in <lambda>
        await run_pulumi_func(lambda: Stack(func))
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 104, in __init__
        func()
      File "/usr/local/bin/pulumi-language-python-exec", line 84, in <lambda>
        coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/runpy.py", line 280, in run_path
        run_name, mod_spec, pkg_name).copy()
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "./__main__.py", line 8, in <module>
        service = Service("***", env, image, port=80)
      File "/Users/jdrake/talos/pulumi/components/service/src/ns_pulumi_component_service/component.py", line 86, in __init__
        "portMappings": [{"containerPort": port, "protocol": "tcp"}],
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/json/__init__.py", line 231, in dumps
        return _default_encoder.encode(obj)
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/json/encoder.py", line 199, in encode
        chunks = self.iterencode(o, _one_shot=True)
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/json/encoder.py", line 257, in iterencode
        return _iterencode(o, 0)
      File "/Users/jdrake/.pyenv/versions/3.6.8/lib/python3.6/json/encoder.py", line 180, in default
        o.__class__.__name__)
    TypeError: Object of type 'Output' is not JSON serializable
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
This is failing when I try to use that image value in a task definition: