Search code examples
serverless-frameworkserverless-plugins

How do you request the DynamoDB.DocumentClient service in a plugin?


To make AWS requests in a plugin, you can do something like this:

  constructor(serverless, options) {
    ...
    this.provider = serverless.getProvider('aws');
  }
    ...
  hook() {
    ...
    await this.provider.request('S3', 'put', params);
  }

How do you request DynamoDB.DocumentClient?

Looking at awsProvider.js, it seems like there is no way to do so. If so, are there any workarounds?


Solution

  • This is now supported in Serverless 1.59.0: https://github.com/serverless/serverless/releases/tag/v1.59.0 (code change: https://github.com/serverless/serverless/pull/7031)