05/15/2023, 4:42 PM
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:
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:
export const customMessageLambda = new aws.lambda.CallbackFunction(
    `customMessage-lambda-${stack}`, { callback: customMessage }
The Working Code:
export const customMessageLambda = new aws.lambda.Function(
    code: new pulumi.asset.FileArchive('./'),
    role: 'arn:aws:iam::617706700270:role/lambdaRole-20db8e5',
    handler: 'customMessage.handler',
    runtime: 'nodejs12.x',


05/18/2023, 2:28 PM
I haven't used Pulumi for Lambda but there are quite a few issues on Pulumi serialising functions. Last comment in this issue talks about building the Lambda outside Pulumi to avoid serialisation by Pulumi, which may help