Open suriya92 opened 1 year ago
Had to specify the key_schema without a list for including just the hash_key to get past the error,
key_schema=aws_native.dynamodb.TableKeySchemaArgs(
attribute_name=DYNAMODB_HASHKEY,
key_type="HASH",
),
But by doing so,running into a different error with the underlying libs
pulumi:pulumi:Stack svc.example-dev running panic: interface conversion: interface {} is map[string]interface {}, not []interface {},
Diagnostics:
pulumi:pulumi:Stack (svc.example-dev):
panic: interface conversion: interface {} is map[string]interface {}, not []interface {}
goroutine 115 [running]:
github.com/pulumi/pulumi-aws-native/provider/pkg/schema.(*sdkToCfnConverter).sdkTypedValueToCfn(0x0?, 0xc0017910e8, {0x28f4ea0?, 0xc001e21080?})
/Users/runner/work/pulumi-aws-native/pulumi-aws-native/provider/pkg/schema/convert.go:75 +0x3d8
github.com/pulumi/pulumi-aws-native/provider/pkg/schema.(*sdkToCfnConverter).sdkTypedValueToCfn(0xc0007b0cf0?, 0xc0017912a0, {0x28f4ea0?, 0xc001e21080?})
/Users/runner/work/pulumi-aws-native/pulumi-aws-native/provider/pkg/schema/convert.go:63 +0x449
github.com/pulumi/pulumi-aws-native/provider/pkg/schema.(*sdkToCfnConverter).sdkToCfn(0xc001791588, 0x0?)
/Users/runner/work/pulumi-aws-native/pulumi-aws-native/provider/pkg/schema/convert.go:40 +0x149
github.com/pulumi/pulumi-aws-native/provider/pkg/schema.SdkToCfn(...)
/Users/runner/work/pulumi-aws-native/pulumi-aws-native/provider/pkg/schema/convert.go:18
github.com/pulumi/pulumi-aws-native/provider/pkg/provider.(*cfnProvider).Create(0xc00068e100, {0x33a1158, 0xc001e20b40}, 0xc001e0c960)
/Users/runner/work/pulumi-aws-native/pulumi-aws-native/provider/pkg/provider/provider.go:733 +0x3bf
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler.func1({0x33a1158, 0xc001e20b40}, {0x2bb65e0?, 0xc001e0c960})
/Users/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.53.1/proto/go/provider_grpc.pb.go:573 +0x78
github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x33a1158, 0xc001e20540}, {0x2bb65e0, 0xc001e0c960}, 0xc0004e7c40, 0xc001e00db0)
/Users/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-201805072[133](https://github.com/peopledatalabs/allpdl/actions/runs/4515787569/jobs/7953480046?pr=4844#step:9:134)50-8e809c8a8645/go/otgrpc/server.go:57 +0x3f9
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler({0x2cda060?, 0xc00068e100}, {0x33a1158, 0xc001e20540}, 0xc000325500, 0xc000d84d40)
/Users/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.53.1/proto/go/provider_grpc.pb.go:575 +0x138
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000e2c000, {0x33a9800, 0xc000e904e0}, 0xc000b999e0, 0xc0011a7920, 0x46624a0, 0x0)
/Users/runner/go/pkg/mod/google.golang.org/grpc@v1.51.0/server.go:[134](https://github.com/peopledatalabs/allpdl/actions/runs/4515787569/jobs/7953480046?pr=4844#step:9:135)0 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc000e2c000, {0x33a9800, 0xc000e904e0}, 0xc000b999e0, 0x0)
/Users/runner/go/pkg/mod/google.golang.org/grpc@v1.51.0/server.go:1713 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
/Users/runner/go/pkg/mod/google.golang.org/grpc@v1.51.0/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
/Users/runner/go/pkg/mod/google.golang.org/grpc@v1.51.0/server.go:963 +0x28a
error: update failed
aws-native:dynamodb:Table (dev-dynamodb-country):
error: error reading from server: EOF
@suriya92 Thanks for reporting this issue in. It appears that this is happening for the Python SDK and I'm not facing this issue for the other languages we support.
Digging deeper, it seems like it's due to the type definition here: https://github.com/pulumi/pulumi-aws-native/blob/53e7f20348e72d11caba6f809bb600f8db2231b1/sdk/python/pulumi_aws_native/dynamodb/table.py#L75
Which is generated from: https://github.com/pulumi/pulumi-aws-native/blob/53e7f20348e72d11caba6f809bb600f8db2231b1/aws-cloudformation-schema/aws-dynamodb-table.json#LL33C15-L33C15
When we attempt to run the Pulumi program, it does a type check to ensure that the Python SDK is being used correctly and has the correct input types. The error you face occurs as list is not comparable to the Union type. We'll need to improve codegeneration for this.
@rquitales I think found the root of the original error. As for the panic when you switched to an object, I think the root of this issue is here: https://github.com/pulumi/pulumi-aws-native/blob/master/provider/pkg/schema/convert.go#L61
The type of TableKeySchemaArgs
is a OneOf{ List(...), Object }
and the provider currently just blindly tries to convert to the first type in the union. We need to make that logic a little smarter or at least handle the case when the values doesn't have the expected type!
I'm going to make a clone of this issue for the original python sdk bug and keep working on the panic here. It's actually a little cleaner to leave this one as the sdk bug as it requires more of the context above to repro so I've opened https://github.com/pulumi/pulumi-aws-native/issues/1009 for the panic
This issue has not been updated in over 180 days. If you are still experiencing this, please leave a comment to let us know that the issue is active.
The issue is still active, I've just encountered the exact same problem.
Thanks for your patience @tlinhart , I was able to repro. It looks like we might be having an issue either with the core Pulumi SDK or codegen for Python here, I've opened https://github.com/pulumi/pulumi/issues/17181 to track.
What happened?
When I try to create a dynamodb table using the aws_native provider( aws classic provider doesn't provide specifications to import backups from s3), I'm getting the following type mismatch error when defining the key_schema(with only the hash key) and unable to proceed further with the configurations.
raise AssertionError(f"Unexpected type. Expected 'list' got '{typ}'") AssertionError: Unexpected type. Expected 'list' got 'typing.Union[typing.Sequence[typing.Union[pulumi_aws_native.dynamodb._inputs.TableKeySchemaArgs, typing.Awaitable[pulumi_aws_native.dynamodb._inputs.TableKeySchemaArgs], pulumi.output.Output[NoneType]]], typing.Any, typing.Awaitable[typing.Union[typing.Sequence[typing.Union[pulumi_aws_native.dynamodb._inputs.TableKeySchemaArgs, typing.Awaitable[pulumi_aws_native.dynamodb._inputs.TableKeySchemaArgs], pulumi.output.Output[NoneType]]], typing.Any]], pulumi.output.Output[NoneType]]'
Expected Behavior
A dynamodb table created or updated with the specified attributes and key_schema.
Steps to reproduce
Output of
pulumi about
Versions: @pulumi/aws 5.10.0 @pulumi/aws-native 0.54.0 @pulumi/pulumi 3.59.0
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).