serverless-appsync-plugin icon indicating copy to clipboard operation
serverless-appsync-plugin copied to clipboard

[v2] -Error when referencing Open Search Service domain

Open ugurhicyilmam opened this issue 2 years ago • 1 comments

Following the configuration structure in tests for open search service data source results in error.

openSearch: { type: 'AMAZON_OPENSEARCH_SERVICE', config: { endpoint: { 'Fn::GetAtt': ['MyEndpoint', 'Arn'] }, }, },

Error: Could not determine the Arn for dataSource 'openSearch

Version: 2.0.0-alpha.15

ugurhicyilmam avatar Jan 23 '23 15:01 ugurhicyilmam

This is because you are providing arn where the plugin is expecting a domain url and the regex behind catches this. However even if you provide the correct url the auto created IAM role behind will have wrong arn specifiend and this will lead to forbidden error on requests.

One way to solve those issues is if you use domain variable instead of endpoint:

dataSources: 
   openSearch:
      type: "AMAZON_OPENSEARCH_SERVICE"
      config:
        domain: OpenSearchDomain

Where 'OpenSearchDomain' is the cloudformation logical id. Example:

Resources:
  OpenSearchDomain:
    Type: AWS::OpenSearchService::Domain
    Properties:
      DomainName: "test-test"

The plugin will use the correct opensearch arn this way.

mstoyanovv avatar Apr 10 '23 10:04 mstoyanovv