Also just started receiving this message after run...
# general
f
Also just started receiving this message after running `pulumi up`:
Copy code
TypeError: Converting circular structure to JSON
        at stringify (<anonymous>)
        at OutputImpl.<anonymous> (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:102:47)
        at Generator.next (<anonymous>)
        at /home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:20:71
        at new Promise (<anonymous>)
        at __awaiter (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:16:12)
        at exports.Output.promise.then (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:89:70)
        at <anonymous>
Could be related to just updating the CLI to 0.17.8.
I have tried deleting node_modules, does not help.
It appears to have something to do with Pulumi printing the stack outputs. I commented out all my `export`s and still get the error.
w
Do you have any calls to
JSON.stringify
in your own code?
f
Downgrading to pulumi CLI 0.17.5 does not fix it.
No
w
Is there more detail in the callstack or is that all you get?
f
Copy code
Diagnostics:
  pulumi:pulumi:Stack (fib-fib-dev):
    TypeError: Converting circular structure to JSON
        at stringify (<anonymous>)
        at OutputImpl.<anonymous> (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:102:47)
        at Generator.next (<anonymous>)
        at /home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:20:71
        at new Promise (<anonymous>)
        at __awaiter (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:16:12)
        at exports.Output.promise.then (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:89:70)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:189:7)
    TypeError: Converting circular structure to JSON
        at stringify (<anonymous>)
        at OutputImpl.<anonymous> (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:102:47)
        at Generator.next (<anonymous>)
        at /home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:20:71
        at new Promise (<anonymous>)
        at __awaiter (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:16:12)
        at exports.Output.promise.then (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:89:70)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:189:7)
 
    error: Running program '/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate' failed with an unhandled exception:
    TypeError: Converting circular structure to JSON
        at stringify (<anonymous>)
        at OutputImpl.<anonymous> (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:102:47)
        at Generator.next (<anonymous>)
        at /home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:20:71
        at new Promise (<anonymous>)
        at __awaiter (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:16:12)
        at exports.Output.promise.then (/home/kenny/compute_software/demo-applications/fibonacci/pulumi-fargate/node_modules/@pulumi/pulumi/output.js:89:70)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:189:7)
FWIW the previous Pulumi version this stack was using was 0.16.
I tried creating an entirely new stack and still received the error.
w
CLI version, or also
@pulumi/pulumi
versions?
And you said that this reprod even after removing stack exports?
f
Just did the CLI. Can try both.
And yes. I commented out all lines that have
export
.
w
Which versions of
@pulumi/pulumi
,
@pulumi/aws
and
@pulumi/awsx
are you using?
f
Copy code
{
  "@pulumi/pulumi": "0.17.8",
  "@pulumi/aws": "0.18.3",
  "@pulumi/awsx": "0.18.3"
}
w
And it works with the old CLI but not the new one? That would be surprising given the error message.
f
No. Downgrading the CLI did not fix the error.
w
Ahh - I see. Do you have any idea what other changes you made recently between when you were not seeing this and when you started seeing it?
f
CLI upgrade and updating from
Copy code
"@pulumi/pulumi": "0.16.14",
"@pulumi/aws": "0.16.7",
"@pulumi/awsx": "0.16.4"
to
Copy code
"@pulumi/pulumi": "0.17.8",
"@pulumi/aws": "0.18.3",
"@pulumi/awsx": "0.18.3"
It only happens with this project - I can run
pulumi up
in other projects.
f
I don't use the former.
l
hey there!
i do see
pulumi-fargate
in your path
are you not using TaskDefs/Services?
there's one thing we can try to help figure this out
f
I am using
awsx.ecs.FargateService
.
l
then it's quite likely to beTaskDefinition
a quick way to find out is to go to that line in your
node_modules/@pulumi...
folder and change it to:
.apply(x => JSON.stringify(x))
can you try that, and see what callstack you get now
also, can you link me to your code that makes the Service
we might be able to see a root cause quickly
f
I think I found it. The
portMappings
API used to take a load balancer and now takes a listener. I was still passing the load balancer. Any way to improve that error message?
l
The
portMappings
API used to take a load balancer
!!!
well, 1. that shouldn't have ever worked 😄
2.... i'm shocked TS allowed that
can you send me your code?
i need to try to repro this
f
I'm fairly certain it worked because the stack was working on 0.16. Sure.
l
because from TS's perspective it has this sig
Copy code
portMappings?: (pulumi.Input<aws.ecs.PortMapping> | ContainerPortMappingProvider)[];
and a LoadBalancer is definitely not either of those!
so i have no idea how TypeSCript even compiled this without issue!
f
Yep - changing to a listener fixed this.
l
where's the line that you had the LB passed in on?
f
97
l
oh... i see because you basically are using hte any-type
so TypeScript couldn't even complain...
hrmm
we can def be more aggressive at trying to weed out bad data. but it's a harder problem in that more or less bad data can be everywhere
f
Is there a better way to write that? I need to dynamically create the
FargateServiceArgs
.
l
and we want to leverage TS pretty heavily to catch more of the stuff.
f
Seems like a common case.
l
in this case, defining it as:
`let fibContainerMap: Record<string, aws.ecs.Container>> = {}
then TS will actually typecheck it and catch those issues
(note: this is def not your fault)
you did something totally reasonable and things blew up.
bbiab
f
Gotcha - ok. I'll add that type hint.
l
This change will also at least help a bit in the future: https://github.com/pulumi/pulumi-awsx/pull/260
as it will give you a callstack that shows you're inside the TaskDef code, not in some random Ouput callstack.
(or, at least, it will help us if we see the callstack) 🙂
f
Thanks!