swift-account-41358
01/06/2025, 4:55 PMclass PrimaryTablePopulatorProvider implements pulumi.dynamic.ResourceProvider {
async create(tableName: string): Promise<pulumi.dynamic.CreateResult> {
await seedDynamoDb(); // Function that's using @aws-sdk to populate the table
return {
outs: {},
id: tableName,
};
}
}
class PrimaryTablePopulator extends pulumi.dynamic.Resource {
constructor(name: string, args: TablePopulatorInputs, opts?: pulumi.CustomResourceOptions) {
super(
new PrimaryTablePopulatorProvider(),
name,
{
...args,
urn: undefined,
id: undefined,
},
opts,
);
}
}
and then inside the SST run() function I do
new PrimaryTablePopulator(
'primary-table-populator',
{
tableName: primaryTable.name,
},
{
dependsOn: [primaryTable],
},
);
I get the error:
Failed
Error: package.json export path for ".pnpm/@aws-sdk+core@3.716.0/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js" not found
at ModuleMap.get (/Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/runtime/closure/package.ts:220:19)
at Object.getModuleFromPath (/Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/runtime/closure/package.ts:273:35)
at /Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/runtime/closure/createClosure.ts:1404:19
at Generator.next (<anonymous>)
at /Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:21:71
at new Promise (<anonymous>)
at __awaiter (/Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:17:12)
at captureModuleAsync (/Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:940:20)
at /Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/runtime/closure/createClosure.ts:1097:19
at Generator.next (<anonymous>)
at fulfilled (/Users/rosscoundon/Documents/GitHub/omw-pso-be/.sst/platform/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:18:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
promise: Promise { <rejected> [Circular *1] }
}
Any thoughts on how to achieve this? I’m not wed to this approach if there’s a simpler or better way. Cheersswift-account-41358
01/07/2025, 4:12 PMprimaryTable.name.apply((name) => {
seedDynamoDb(name).catch((err) => {
console.error(`Error seeding DynamoDB: ${err}`);
});
});
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by