Has anyone run into this error: ```panic: interfac...
# aws
b
Has anyone run into this error:
Copy code
panic: interface conversion: interface {} is []interface {}, not *schema.Set
while deploying with GitHub actions? Full diagnostics:
Copy code
Diagnostics:
    aws:lambda:Function (****-handler-lambda-function-dev):
      error: transport is closing
   
    aws:s3:BucketObject (****-handler-deployment-dev.zip):
      error: transport is closing
   
    pulumi:pulumi:Stack (****-dev):
      error: update failed
   
      panic: interface conversion: interface {} is []interface {}, not *schema.Set
      goroutine 438 [running]:
      <http://github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLambdaFunctionUpdate(0xc001bf6480|github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLambdaFunctionUpdate(0xc001bf6480>, 0x6d569e0, 0xc0015f6c00, 0x0, 0x0)
      	/home/runner/go/pkg/mod/github.com/pulumi/terraform-provider-aws@v1.38.1-0.20211004122636-8966d24576a0/aws/resource_aws_lambda_function.go:1199 +0x522d
      <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc000717110|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc000717110>, 0x8963f18, 0xc00012c018, 0xc001bf6480, 0x6d569e0, 0xc0015f6c00, 0x0, 0x0, 0x0)
      	/home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20210629210550-59d24255d71f/helper/schema/resource.go:342 +0x1ee
      <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000717110|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000717110>, 0x8963f18, 0xc00012c018, 0xc0023278f0, 0xc00139a4c0, 0x6d569e0, 0xc0015f6c00, 0x8, 0x10, 0x7fa1682565b8, ...)
      	/home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20210629210550-59d24255d71f/helper/schema/resource.go:454 +0x390
      <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Provider.Apply(0xc00107a1e0|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Provider.Apply(0xc00107a1e0>, 0x7cc8d72, 0x13, 0x8964e68, 0xc002251340, 0x898b330, 0xc00139a4c0, 0x0, 0x898b330, 0xc00139a4c0, ...)
      	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.8.2-0.20210930033847-5bba386a0e79/pkg/tfshim/sdk-v2/provider.go:112 +0x210
      <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Update(0xc00000a3c0|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Update(0xc00000a3c0>, 0x8963f88, 0xc001bc2630, 0xc001b0d380, 0xc00000a3c0, 0x6ca9101, 0xc002243080)
      	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.8.2-0.20210930033847-5bba386a0e79/pkg/tfbridge/provider.go:1038 +0x9a3
      <http://github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Update_Handler.func1(0x8963f88|github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Update_Handler.func1(0x8963f88>, 0xc001bc2630, 0x7a70020, 0xc001b0d380, 0x7a24600, 0xd580058, 0x8963f88, 0xc001bc2630)
      	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.13.2/proto/go/provider.pb.go:2638 +0x8b
      <http://github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x8963f88|github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x8963f88>, 0xc001bc20c0, 0x7a70020, 0xc001b0d380, 0xc00132f1a0, 0xc001562c00, 0x0, 0x0, 0x8876e20, 0xc000400a70)
      	/home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x30a
      <http://github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Update_Handler(0x7b63f20|github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Update_Handler(0x7b63f20>, 0xc00000a3c0, 0x8963f88, 0xc001bc20c0, 0xc0010555c0, 0xc00145b800, 0x8963f88, 0xc001bc20c0, 0xc0009b4c00, 0xadc)
      	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.13.2/proto/go/provider.pb.go:2640 +0x150
      <http://google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003cb6c0|google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003cb6c0>, 0x898bcf8, 0xc0015a6180, 0xc0024af440, 0xc0015316b0, 0xd53aa30, 0x0, 0x0, 0x0)
      	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:1217 +0x52b
      <http://google.golang.org/grpc.(*Server).handleStream(0xc0003cb6c0|google.golang.org/grpc.(*Server).handleStream(0xc0003cb6c0>, 0x898bcf8, 0xc0015a6180, 0xc0024af440, 0x0)
      	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:1540 +0xd0c
      <http://google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000ea8050|google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000ea8050>, 0xc0003cb6c0, 0x898bcf8, 0xc0015a6180, 0xc0024af440)
      	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:878 +0xab
      created by <http://google.golang.org/grpc.(*Server).serveStreams.func1|google.golang.org/grpc.(*Server).serveStreams.func1>
      	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:876 +0x1fd
Happening locally with
pulumi up
as well
b
can you share your code?
b
@billowy-army-68599 ^
b
hrm, I think we'll need to have an issue opened for this, I don't see any immediate issues there
b
okie thank you! will open a GitHub issue
l
Aside: I'm interested in how the
environment
and
vpcConfig
args work. You've not provided a property name on the LHS. Is that a typescript feature, where it figures out the property name from the variable name? I've never seen it before.
b
yup just simple TypeScript params so that I don’t have to manually add typings for environment / vpc config (found in pulumi-aws typescript definitions):
Copy code
interface FunctionEnvironment {
        /**
         * Map of environment variables that are accessible from the function code during execution.
         */
        variables?: pulumi.Input<{
            [key: string]: pulumi.Input<string>;
        }>;
    }

    interface FunctionVpcConfig {
        /**
         * List of security group IDs associated with the Lambda function.
         */
        securityGroupIds: pulumi.Input<pulumi.Input<string>[]>;
        /**
         * List of subnet IDs associated with the Lambda function.
         */
        subnetIds: pulumi.Input<pulumi.Input<string>[]>;
        vpcId?: pulumi.Input<string>;
    }
l
Yes I'm ok with the types, I'm fascinated by the fact you have
Copy code
...
  handler: "index.handler",
  environment,
  vpcConfig,
});
I expect this:
Copy code
...
  handler: "index.handler",
  environment: environment,
  vpcConfig: vpcConfig,
});
b
ohhhh yea that’s ESLint convention I like to use https://eslint.org/docs/rules/object-shorthand
r
Definitely one of my favorite ES6 features ^ @little-cartoon-10569 not just a TS thing: https://www.geeksforgeeks.org/shorthand-syntax-for-object-property-value-in-es6/
The panic, while unclear, looks like you’re using an array somewhere you should be using an object.
b
hmm looks like Pulumi examples use JSON.stringify for the policy object https://www.pulumi.com/docs/reference/pkg/aws/iam/policy/ i’ll try that
r
You might be able to get more information about where exactly the issue is by using
--logtostderr -v=9
https://www.pulumi.com/docs/troubleshooting/#verbose-logging
You shouldn’t need to use
JSON.stringify
in that specific case because it has a
PolicyDocument
type which means that it gets converted to json string under the hood.
q
@brainy-helmet-80249 Please post a link to the ticket once it’s created. I just got that error for the first time. I’d like to follow the progress.
r
@quick-apartment-308 please debug the issue yourself using verbose logging. This is more likely a user issue than a problem on the pulumi side.
👀 2
e
We've just experienced this error after upgrading our installed version of pulumi from 3.12.0 to 3.14.0
Ours seems to be happening when trying to update a lambda function
Using @red-match-15116's logging suggestion, I see:
Copy code
I1008 15:53:58.673933   34391 rpc.go:74] Marshaling property for RPC[Provider[aws, 0xc0018d6c00].Update(<<redacted>>,urn:pulumi:dev::<<redacted>>::aws:ec2/securityGroup:SecurityGroup$aws:iam/role:Role$aws:lambda/function:Function::<<redacted>>).news]: subnetIds={[{<<redacted>>} {<<redacted>>}]}
I1008 15:53:58.680811   34391 eventsink.go:59] Locking "aws_lambda_function"
I1008 15:53:58.680826   34391 eventsink.go:62] eventSink::Debug(<{%reset%}>Locking "aws_lambda_function"<{%reset%}>)
I1008 15:53:58.681017   34391 eventsink.go:59] Locked "aws_lambda_function"
I1008 15:53:58.681029   34391 eventsink.go:62] eventSink::Debug(<{%reset%}>Locked "aws_lambda_function"<{%reset%}>)
I1008 15:53:58.681373   34391 eventsink.go:59] Unlocking "aws_lambda_function"
I1008 15:53:58.681386   34391 eventsink.go:62] eventSink::Debug(<{%reset%}>Unlocking "aws_lambda_function"<{%reset%}>)
I1008 15:53:58.681559   34391 eventsink.go:59] Unlocked "aws_lambda_function"
I1008 15:53:58.681568   34391 eventsink.go:62] eventSink::Debug(<{%reset%}>Unlocked "aws_lambda_function"<{%reset%}>)
I1008 15:53:58.681568   34391 eventsink.go:62] eventSink::Debug(<{%reset%}>Unlocked "aws_lambda_function"<{%reset%}>)
I1008 15:53:58.684201   34391 eventsink.go:78] eventSink::Infoerr(<{%reset%}>panic: interface conversion: interface {} is []interface {}, not *schema.Set
(where
<<redacted>>
are our names/ ids)
b
@enough-leather-70274 @quick-apartment-308 I converted all our magic lambda functions to actual lambda functions (using
*new* aws.lambda.Function
) and made sure to pass in a role's name (instead of the role) when defining RolePolicyAttachments. Those two steps got our build working again on 3.14.0.
Copy code
new aws.iam.RolePolicyAttachment(
    `${functionName}-lambda-execute-role-policy-attachment-${stack}`,
    {
      role: lambdaRole.name, // Pass in the name here, instead of lambdaRole
      policyArn: aws.iam.ManagedPolicy.AWSLambdaExecute,
    }
  );
e
We're on python - not using magic lambdas but rather actual lambda functions and we use the id for the role when defining RolePolicyAttachments. Switching them to name doesn't seem to have any impact.
b
Hi folks - what version of the AWS provider are you using?
If it's
4.22.2
(the latest) then try downgrading to `4.22.1`: https://github.com/pulumi/pulumi-aws/issues/1651
It seems to be an issue across languages