bumpy-grass-54508
05/18/2021, 1:24 PMOutput<string> handlerCode = ... // based on other outputs in the stack
var handlerArchive = handlerCode.Apply(code => (Archive)new AssetArchive(new Dictionary<string, AssetOrArchive>
{
["index.js"] = new StringAsset(code),
}));
var function = new Pulumi.Aws.Lambda.Function("function", new Pulumi.Aws.Lambda.FunctionArgs
{
Code = handlerArchive,
Handler = "index.handler",
Role = role.Arn,
Runtime = Pulumi.Aws.Lambda.Runtime.NodeJS14dX,
});
creating the function works fine, and subsequent up
operations sometimes work fine - but in one particular stack I am working on I consistently get this error
System.InvalidOperationException: Expected Pulumi.Archive but got System.String deserializing Pulumi.Aws.Lambda.Function.code
at Pulumi.Serialization.Converter.ConvertObject(String context, Object val, Type targetType)
at Pulumi.Serialization.Converter.ConvertValue(String context, Value value, Type targetType, ImmutableHashSet`1 resources)
at Pulumi.Deployment.CompleteResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources)
at Pulumi.Deployment.Runner.<>c__DisplayClass9_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Pulumi.Deployment.Runner.WhileRunningAsync()<{%reset%}>)
want to double check I should even be creating this Archive in an Apply or if that is not supportedtall-librarian-49374
05/18/2021, 1:37 PMbumpy-grass-54508
05/18/2021, 1:47 PMstring | Promise<string>
and AssetMap | Promise<AssetMap>
etc, but the c# AssetArchive only takes in a Dictionary<string, AssetOrArchive>
and StringAsset only accepts a string
tall-librarian-49374
05/18/2021, 2:46 PMbumpy-grass-54508
05/18/2021, 9:13 PMrefresh
that is rewriting the archive's representation in the state file. output<t> was just a red herring and/or a bad hunch! hahtall-librarian-49374
05/18/2021, 9:15 PMbumpy-grass-54508
05/18/2021, 9:18 PMpulumi refresh
and keep going. i might be able to poke around the refresh implementation at a later point but let me know if i can provide any more info to help out!