When using `bundle.format: 'esm'` with `ApolloAPI`...
# help
m
When using
bundle.format: 'esm'
with
ApolloAPI
, I get the following when trying to make a request:
Copy code
Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Dynamic require of \"stream\" is not supported","reason":"Error: Dynamic require of \"stream\" is not supported","promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: Dynamic require of \"stream\" is not supported","    at process.<anonymous> (file:///home/mclifford/Development/github.com/cliffom/sst-bff-demo/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (node:events:390:28)","    at emit (node:internal/process/promises:136:22)","    at processPromiseRejections (node:internal/process/promises:242:25)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
The definition is not complicated:
Copy code
this.setDefaultFunctionProps({
    runtime: 'nodejs14.x',
    bundle: {
        format: 'esm'
    }
});

// Create the Apollo GraphQL API
const apollo = new sst.ApolloApi(this, 'ApolloApi', {
    server: new sst.Function(this, 'ApolloLambda', {
    handler: 'src/handlers/apollo/lambda.handler',
    environment: {
        USERS_API_URL: props?.usersAPI.url as string,
        STAGE: scope.stage,
    },
    }),
});
t
Apollo API does not bundle for ESM so it can't be used with esm