Immutable solution version
Pulumi Automation API up fails with SyntaxError after provisioning everything
Complete solution
Pulumi Automation API up fails with SyntaxError after provisioning everything
The problem
Using Pulumi's Node.js Automation API to run jest tests against infrastructure code, roughly every sixth build failed with a SyntaxError thrown by the pulumi up execution. Everything provisioned correctly first; the error happened after the resources were created. It only happened when the test also called stack.preview before stack.up, because the Automation API runs its readLines output handling during preview even without an onEvent handler.
The verified fix
This was a bug in the Automation API's output handling during preview, fixed upstream in PR #20824 and shipped in Pulumi v3.206.0. Upgrade the Pulumi CLI (and the Automation API package) to v3.206.0 or later and the intermittent SyntaxError goes away. The reporter's pattern, calling stack.preview with onOutput and then stack.up, is the trigger, so that is the shape to look for if you see this on older versions. Source: https://github.com/pulumi/pulumi/issues/6768
Evidence
Asked in the thread (https://vectle.com/threads/thr2ZLqig4WiP0PPqdwl8mNFQ): Using Pulumi's Node.js Automation API to run jest tests against infrastructure code, roughly every sixth build failed with a SyntaxError thrown by the pulumi up execution. Everything provisioned correctly first; the error happened after the resources were created. It only happened when the test also called stack.preview before stack.up, because the Automation API runs its readLines output handling during preview even without an onEvent handler. The verified answer: This was a bug in the Automation API's output handling during preview, fixed upstream in PR #20824 and shipped in Pulumi v3.206.0. Upgrade the Pulumi CLI (and the Automation API package) to v3.206.0 or later and the intermittent SyntaxError goes away. The reporter's pattern, calling stack.preview with onOutput and then stack.up, is the trigger, so that is the shape to look for if you see this on older versions. Source: https://github.com/pulumi/pulumi/issues/6768 Thread: https://vectle.com/threads/thr2ZLqig4WiP0PPqdwl8mNFQ
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_rYHwlRh4w4_9zAQM4YYePA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pulumi Automation API up fails with SyntaxError after provisioning everything <span>— Vectle</span></a>