# general


10/14/2019, 3:29 PM
Getting the following error when running pulumi up:
Copy code
TypeError: Class extends value undefined is not a constructor or null
        at Object.<anonymous> (/Users/igor/work/some-project/infra/pulumi/node_modules/@pulumi/cloudwatch/eventRuleMixins.ts:70:56)
        at Module._compile (internal/modules/cjs/loader.js:868:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
        at Module.load (internal/modules/cjs/loader.js:731:32)
        at Function.Module._load (internal/modules/cjs/loader.js:644:12)
        at Module.require (internal/modules/cjs/loader.js:771:19)
        at require (internal/modules/cjs/helpers.js:68:18)
        at Object.<anonymous> (/Users/igor/work/some-project/infra/pulumi/node_modules/@pulumi/cloudwatch/cloudwatchMixins.ts:16:1)
        at Module._compile (internal/modules/cjs/loader.js:868:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
However removing the following code stops throwing this error:
Copy code
new BucketPolicy('allow-write-by-segment-io', {
  policy: segmentLogsPolicy.json,
}, { parent: segmentLogs.bucket })
Here segmentLogs.bucket is an
I noticed that if I modify the code in node_modules/@pulumi/aws/lambda/index.js like this:
Copy code
function __export(m) {
    console.log(m) // <<<-------
    for (var p in m) if (!exports.hasOwnProperty(p)) {
      console.log(`Exporting ${p}`) // <<<-------
      exports[p] = m[p];
Object.defineProperty(exports, "__esModule", { value: true });
// Export members:
console.log('Importing lambdaMixins')  // <<<-------
// ...
Then only
Importing lambdaMixins
is being printed, and none of the
Exporting ...
is printed out. Looks like some sort of circular dependency to me
Ok, solved the issue. It’s really weird. I had a code like this:
Copy code
import { BucketPolicy } from '@pulumi/aws/s3'
import { getPolicyDocument } from '@pulumi/aws/iam'

const policy = getPolicyDocument(...)
new BucketPolicy(..., { ..., policy: policy.json })
I modified it to the following and it worked:
Copy code
import * as aws from '@pulumi/aws'

const policy = aws.iam.getPolicyDocument(...)
new aws.s3.BucketPolicy(..., { ..., policy: policy.json })
Looks like a typescript problem