aws / aws/aws-cdk

Accelerator: FromAcceleratorAttributes method gives CS0426 error

Open
#28,076 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-globalaccelerator bug effort/medium language/dotnet p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When I try to use the FromAcceleratorAttributes method to get an existing Global Accelerator I get a CS0426 error.

```
Accelerator globalAccelerator = new Accelerator.FromAcceleratorAttributes(this, $"TestGlobalAccelerator", new AcceleratorAttributes()
{
AcceleratorArn = System.Environment.GetEnvironmentVariable("AcceleratorArn"),
DnsName = System.Environment.GetEnvironmentVariable("DnsName"),
});
```

Severity Code Description
Error CS0426 The type name 'FromAcceleratorAttributes' does not exist in the type 'Accelerator'

### Expected Behavior

That I can reference an existing Global Accelerator in my stack.

### Current Behavior

Error Message in VS2022

### Reproduction Steps

Use this code

```
Accelerator globalAccelerator = new Accelerator.FromAcceleratorAttributes(this, $"TestGlobalAccelerator", new AcceleratorAttributes()
{
AcceleratorArn = System.Environment.GetEnvironmentVariable("AcceleratorArn"),
DnsName = System.Environment.GetEnvironmentVariable("DnsName"),
});
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.106.0

### Framework Version

_No response_

### Node.js Version

v18.16.0

### OS

Windows 11

### Language

.NET

### Language Version

6.0

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported code in a .NET AWS CDK project using CDK CLI version 2.106.0 and inspect the Accelerator and FromAcceleratorAttributes API surface. Confirm whether the existing Global Accelerator reference can compile from the shown call, and consider the issue done when the equivalent reference compiles and the CS0426 error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.