amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Support AppSync custom domains

Open otottkovacstibor opened this issue 1 year ago • 2 comments

Environment information

System:
  OS: macOS 14.5
  CPU: (12) arm64 Apple M3 Pro
  Memory: 51.98 MB / 18.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
  Yarn: undefined - undefined
  npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.2.0
  @aws-amplify/backend: 1.0.4
  @aws-amplify/backend-auth: 1.1.0
  @aws-amplify/backend-cli: 1.2.1
  @aws-amplify/backend-data: 1.1.0
  @aws-amplify/backend-deployer: 1.0.2
  @aws-amplify/backend-function: 1.3.0
  @aws-amplify/backend-output-schemas: 1.1.0
  @aws-amplify/backend-output-storage: 1.0.2
  @aws-amplify/backend-secret: 1.0.0
  @aws-amplify/backend-storage: 1.0.4
  @aws-amplify/cli-core: 1.1.1
  @aws-amplify/client-config: 1.1.1
  @aws-amplify/deployed-backend-client: 1.1.0
  @aws-amplify/form-generator: 1.0.0
  @aws-amplify/model-generator: 1.0.2
  @aws-amplify/platform-core: 1.0.3
  @aws-amplify/plugin-types: 1.1.0
  @aws-amplify/sandbox: 1.1.1
  @aws-amplify/schema-generator: 1.2.0
  aws-amplify: 6.4.3
  aws-cdk: 2.150.0
  aws-cdk-lib: 2.150.0
  typescript: 5.5.4
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Description

A custom domain name and an API mapping can be created using CDK, however, the amplify_outputs.json always contains the original generated version of the GraphQL endpoint even if a custom domain is attached. This is not ideal to use this URL, especially for mobile applications since it can happen that the stack needs to be recreated for some reason, and the previously generated endpoint will be no longer available.

I tried to override the value by backend.addOutput({ data: { url: 'my-custom-url' } }), but this is not supported in this way.

Is there any other way to somehow automate this step? Thanks

otottkovacstibor avatar Jul 29 '24 19:07 otottkovacstibor

Hey @otottkovacstibor :wave: thanks for raising this! I think this is a great idea to introduce first-class support for custom domains in Amplify resources. Marking as a feature request

josefaidt avatar Jul 30 '24 15:07 josefaidt

hey @josefaidt it would be a really good to have feature!

@otottkovacstibor one pretty hacky work account i have found is that before we call:

Amplify.configure(outputs);

We can do something like the following:

if (outputs && outputs.data) {
  outputs.data.url = "https://api.example.com/graphql";
}

Not at all ideal but help to fix the current problem

allgandalf avatar Nov 28 '24 13:11 allgandalf