Hi everyone, I have the following config for creat...
# seed
l
Hi everyone, I have the following config for creating API's and it works locally
Copy code
defaults: {
      function: {
        environment,
        vpc: vpc,
        vpcSubnets: {
          subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
        },
        bundle: {
          externalModules: ['pg', 'better-sqlite3', 'mysql2']
        }
      }
    },
But the above does not work when I try to deploy with seed.run
Copy code
Error: There was a problem transpiling the Lambda handler: > node_modules/kysely/dist/cjs/dialect/postgres/postgres-driver.js:80:68: error: Could not resolve "pg" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
    80 │ ... const pgModule = await Promise.resolve().then(() => require('pg'));
       ╵                                                                 ~~~~
 > node_modules/kysely/dist/cjs/dialect/sqlite/sqlite-driver.js:68:72: error: Could not resolve "better-sqlite3" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
    68 │ ...ule = await Promise.resolve().then(() => require('better-sqlite3'));
       ╵                                                     ~~~~~~~~~~~~~~~~
 > node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:99:71: error: Could not resolve "mysql2" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
    99 │ ...mysqlModule = await Promise.resolve().then(() => require('mysql2'));
Please let me know if there is anything else that I need to add to the config. Thanks
f
Leaving a note here, following up in this thread https://serverless-stack.slack.com/archives/C01JG3B20RY/p1652759429487509