aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 821 forks source link

No data source found when trying to make custom resolver for elastic search #1046

Closed uchar closed 5 years ago

uchar commented 5 years ago

I'm trying to use geolocation in aws-amplify api base on this documentation : add-a-custom-geolocation-search-resolver-that-targets-an-elasticsearch-domain-created-by-searchable For value of ElasticSearchDomain I used the output domain of this command : aws es list-domain-names

My CustomResouce.json file is : `

"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An auto-generated nested stack.",
"Metadata": {},
"Parameters": {
    "AppSyncApiId": {
        "Type": "String",
        "Description": "The id of the AppSync API associated with this project."
    },
    "AppSyncApiName": {
        "Type": "String",
        "Description": "The name of the AppSync API",
        "Default": "AppSyncSimpleTransform"
    },
    "env": {
        "Type": "String",
        "Description": "The environment name. e.g. Dev, Test, or Production",
        "Default": "NONE"
    },
    "S3DeploymentBucket": {
        "Type": "String",
        "Description": "The S3 bucket containing all deployment assets for the project."
    },
    "S3DeploymentRootKey": {
        "Type": "String",
        "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory."
    }
},
"Resources": {
    "QueryNearbyUsers": {
        "Type": "AWS::AppSync::Resolver",
        "Properties": {
            "ApiId": {
                "Ref": "AppSyncApiId"
            },
            "DataSourceName": "api-ref-elasti-******",
            "TypeName": "Query",
            "FieldName": "nearbyUsers",
            "RequestMappingTemplateS3Location": {
                "Fn::Sub": [
                    "s3://${S3DeploymentBucket}/${S3DeploymentRootKey}/resolvers/Query.nearbyUsers.req.vtl",
                    {
                        "S3DeploymentBucket": {
                            "Ref": "S3DeploymentBucket"
                        },
                        "S3DeploymentRootKey": {
                            "Ref": "S3DeploymentRootKey"
                        }
                    }
                ]
            },
            "ResponseMappingTemplateS3Location": {
                "Fn::Sub": [
                    "s3://${S3DeploymentBucket}/${S3DeploymentRootKey}/resolvers/Query.nearbyUsers.res.vtl",
                    {
                        "S3DeploymentBucket": {
                            "Ref": "S3DeploymentBucket"
                        },
                        "S3DeploymentRootKey": {
                            "Ref": "S3DeploymentRootKey"
                        }
                    }
                ]
            }
        }
    }
},
"Conditions": {
    "HasEnvironmentParameter": {
        "Fn::Not": [
            {
                "Fn::Equals": [
                    {
                        "Ref": "env"
                    },
                    "NONE"
                ]
            }
        ]
    }
},
"Outputs": {
    "EmptyOutput": {
        "Description": "An empty output. You may delete this if you have at least one resource above.",
        "Value": ""
    }
}

` But after trying to use amplify push it give me this error :

Resource Name: QueryNearbyUsers (AWS::AppSync::Resolver) Event Type: create Reason: No data source found named *** (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 920993d8-46ef-11e9-82c8-e977f5face03)

Shouldn't it work ?! If not where can I findElasticSearchDomain value ?!

uchar commented 5 years ago

Ok I fixed it, it seems there is a typo in documentation and It should be :

"DataSourceName": "ElasticSearchDomain",

not :

"DataSourceName": "ElasticsearchDomain",

now it's working fine.. so many hours wasted on such a simple typo.

yuth commented 5 years ago

@uchar Thanks for the pointing the issue in Docs. I have updated the doc site to fix typo

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.