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

full-dress-10026

04/30/2019, 5:16 PM
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

white-balloon-205

04/30/2019, 6:14 PM
Do you have any calls to
JSON.stringify
in your own code?
f

full-dress-10026

04/30/2019, 6:14 PM
Downgrading to pulumi CLI 0.17.5 does not fix it.
No
w

white-balloon-205

04/30/2019, 6:16 PM
Is there more detail in the callstack or is that all you get?
f

full-dress-10026

04/30/2019, 6:17 PM
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

white-balloon-205

04/30/2019, 6:18 PM
CLI version, or also
@pulumi/pulumi
versions?
And you said that this reprod even after removing stack exports?
f

full-dress-10026

04/30/2019, 6:19 PM
Just did the CLI. Can try both.
And yes. I commented out all lines that have
export
.
w

white-balloon-205

04/30/2019, 6:20 PM
Which versions of
@pulumi/pulumi
,
@pulumi/aws
and
@pulumi/awsx
are you using?
f

full-dress-10026

04/30/2019, 6:20 PM
Copy code
{
  "@pulumi/pulumi": "0.17.8",
  "@pulumi/aws": "0.18.3",
  "@pulumi/awsx": "0.18.3"
}
w

white-balloon-205

04/30/2019, 6:20 PM
And it works with the old CLI but not the new one? That would be surprising given the error message.
f

full-dress-10026

04/30/2019, 6:21 PM
No. Downgrading the CLI did not fix the error.
w

white-balloon-205

04/30/2019, 6:23 PM
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

full-dress-10026

04/30/2019, 6:24 PM
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

full-dress-10026

04/30/2019, 6:32 PM
I don't use the former.
l

lemon-spoon-91807

04/30/2019, 6:32 PM
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

full-dress-10026

04/30/2019, 6:33 PM
I am using
awsx.ecs.FargateService
.
l

lemon-spoon-91807

04/30/2019, 6:33 PM
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

full-dress-10026

04/30/2019, 6:37 PM
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

lemon-spoon-91807

04/30/2019, 6:37 PM
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

full-dress-10026

04/30/2019, 6:38 PM
I'm fairly certain it worked because the stack was working on 0.16. Sure.
l

lemon-spoon-91807

04/30/2019, 6:38 PM
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

full-dress-10026

04/30/2019, 6:40 PM
Yep - changing to a listener fixed this.
l

lemon-spoon-91807

04/30/2019, 6:41 PM
where's the line that you had the LB passed in on?
f

full-dress-10026

04/30/2019, 6:41 PM
97
l

lemon-spoon-91807

04/30/2019, 6:43 PM
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

full-dress-10026

04/30/2019, 6:43 PM
Is there a better way to write that? I need to dynamically create the
FargateServiceArgs
.
l

lemon-spoon-91807

04/30/2019, 6:43 PM
and we want to leverage TS pretty heavily to catch more of the stuff.
f

full-dress-10026

04/30/2019, 6:43 PM
Seems like a common case.
l

lemon-spoon-91807

04/30/2019, 6:44 PM
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

full-dress-10026

04/30/2019, 6:49 PM
Gotcha - ok. I'll add that type hint.
l

lemon-spoon-91807

05/01/2019, 12:44 AM
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

full-dress-10026

05/01/2019, 12:45 AM
Thanks!