I am trying to migrate from Pulumi Cloud to self-h...
# general
h
I am trying to migrate from Pulumi Cloud to self-hosted in an s3 bucket and getting errors that seem related to serialization, has anyone experienced this? It seems to mainly happen with lambdas. I can get them working by changing them from the aws.lambda.CallbackFunction syntax to aws.lambda.Function, but it would be nice to keep the original syntax. Does s3 serialize differently and is there a better way to fix this? The Error:
Copy code
error: Error serializing function 'customMessage': index.ts(192,22)
    
    function 'customMessage': index.ts(192,22): which could not be serialized because
      Could not find [[Scopes]] property
    
    Function code:
      function customMessage(event, context) {
          var _a, _b;
          return __awaiter(this, void 0, void 0, function* () {
              console.log('event', event);
              if (event.triggerSource === "CustomMessage_AdminCreateUser") {
      ...
The Original Code:
Copy code
export const customMessageLambda = new aws.lambda.CallbackFunction(
    `customMessage-lambda-${stack}`, { callback: customMessage }
);
The Working Code:
Copy code
export const customMessageLambda = new aws.lambda.Function(
  `customMessage-lambda-new`,
  {
    code: new pulumi.asset.FileArchive('./customMessage.zip'),
    role: 'arn:aws:iam::617706700270:role/lambdaRole-20db8e5',
    handler: 'customMessage.handler',
    runtime: 'nodejs12.x',
  }
);
s
I haven't used Pulumi for Lambda but there are quite a few issues on Pulumi serialising functions. https://www.google.co.uk/search?q=typescript+pulumi+Error+serializing+function+site%3Agithub.com Last comment in this issue talks about building the Lambda outside Pulumi to avoid serialisation by Pulumi, which may help https://github.com/pulumi/pulumi-aws/issues/2329