Open ataylorme opened 1 week ago
I was able to get the values I needed from amplify_outputs.json
Auth.tsx
now looks like this:
import amplifyOutputs from '../amplify_outputs.json';
Amplify.configure(
{
Auth: {
Cognito: {
userPoolId: amplifyOutputs.auth.user_pool_id,
userPoolClientId: amplifyOutputs.auth.user_pool_client_id,
identityPoolId: amplifyOutputs.auth.identity_pool_id,
I was also able to get the custom API added to amplify_outputs.json
by adding this to backend.ts
:
backend.addOutput({
custom: {
API: {
[ghProvider.api.restApiName]: {
endpoint: ghProvider.apiUrl,
region: Stack.of(ghProvider.api).region,
apiName: ghProvider.api.restApiName,
},
},
},
});
I can then be used in Amplify.configure
like this:
API: {
REST: {
api: {
endpoint: amplifyOutputs.custom.API['GitHub API Gateway'].endpoint,
},
},
},
I can make a PR if you are interested, let me know
Howdy 👋, first of all, thank you for making the video and providing this repo with the code sample! When using
npx ampx sandbox
I am not getting aamplifyconfiguration.json
file. There isamplify_outputs.json
but that doesn't have the REST API information.Reading through the Amplify gen2 docs I think
backend.addOutput
is needed to add the REST API info toamplify_outputs.json
.I am hoping you can update
Auth.tsx
to useamplify_outputs.json
instead ofamplifyconfiguration.json
and even get the REST API URL dynamically