Skip to content

Commit 8b60ff4

Browse files
brendan-smpclaude
andauthored
fix(Vpc): use self.natInstances in registerOutputs to fix Vpc.get() with bastion (#6347)
When using Vpc.get() to reference an existing VPC created with bastion: true, deployment fails with "Cannot access 'natInstances' before initialization". The registerOutputs() function incorrectly references the local variable `natInstances` instead of the class property `self.natInstances`. In the ref path (Vpc.get), registerOutputs() is called before the local variable is defined, but the class property is already set from ref.natInstances. Fixes #6346 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4d1e3c5 commit 8b60ff4

File tree

1 file changed

+1
-1
lines changed
  • platform/src/components/aws

1 file changed

+1
-1
lines changed

platform/src/components/aws/vpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ export class Vpc extends Component implements Link.Linkable {
690690
([bastion, elasticIps, privateKeyValue, privateSubnets, publicSubnets]) => {
691691
if (!bastion) return;
692692
return {
693-
ip: natInstances.apply((instances) =>
693+
ip: self.natInstances.apply((instances) =>
694694
instances.length ? elasticIps[0]?.publicIp : bastion.publicIp,
695695
),
696696
username: "ec2-user",

0 commit comments

Comments
 (0)