Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amplify import auth causes build failure - auth headless init is missing the following inputParams userPoolId, webClientId, nativeClientId #1271

Open
fujiwaka2408 opened this issue Nov 24, 2020 · 61 comments

Comments

@fujiwaka2408
Copy link

Hi,

I used amplify import auth to import an existing Cognito UserPool into my project. I committed my code to git and pushed, which kicked off an Amplify Console pipeline, the build of the backend failed with the following error message.
Error: auth headless init is missing the following inputParams userPoolId, webClientId, nativeClientId

Since amplify push worked fine from the local machine, I expected the build and deployment in the amplify console to work fine as well.

In this Issue, you will see similar errors for parameters such as facebookAppId, amazonAppId, googleClientId, etc. They had added these parameters as environment variables to amplifyPush.sh. So I added error inputParams as environment variables and the build was successful.

This problem occurs only when I do amplify import auth (not amplify add auth).
Is it because the environment variables in the shell script are missing, i.e., the shell script does not yet support import auth? Or are there other possible causes?

Here is the actual script (myamplifyPush.sh) that I used.

#!/usr/bin/env bash
set -e
IFS='|'

help_output () {
    echo "usage: amplify-push <--environment|-e <name>> <--simple|-s>"
    echo "  --environment  The name of the Amplify environment to use"
    echo "  --simple  Optional simple flag auto-includes stack info from env cache"
    exit 1
}

init_env () {
    ENV=$1
    AMPLIFY=$2
    PROVIDERS=$3
    CODEGEN=$4
    AWSCONFIG=$5
    CATEGORIES=$6

    echo "# Start initializing Amplify environment: ${ENV}"
    if [[ -z ${STACKINFO} ]];
    then
        echo "# Initializing new Amplify environment: ${ENV} (amplify init)"
        [[ -z ${CATEGORIES} ]] && amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --yes || amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --categories ${CATEGORIES} --yes
        echo "# Environment ${ENV} details:"
        amplify env get --name ${ENV}
    else
        echo "STACKINFO="${STACKINFO}
        echo "# Importing Amplify environment: ${ENV} (amplify env import)"
        amplify env import --name ${ENV} --config "${STACKINFO}" --awsInfo ${AWSCONFIG} --yes;
        echo "# Initializing existing Amplify environment: ${ENV} (amplify init)"
        [[ -z ${CATEGORIES} ]] && amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --yes || amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --categories ${CATEGORIES} --yes
        echo "# Environment ${ENV} details:"
        amplify env get --name ${ENV}
    fi
    echo "# Done initializing Amplify environment: ${ENV}"
}

ENV=""
IS_SIMPLE=false
POSITIONAL=()
while [[ $# -gt 0 ]]
    do
    key="$1"
    case ${key} in
        -e|--environment)
        ENV=$2
        shift
        ;;
        -r|--region)
        REGION=$2
        shift
        ;;
        -s|--simple)
        IS_SIMPLE=true
        shift
        ;;
        *)
        POSITIONAL+=("$1")
        shift
        ;;
    esac
done
set -- "${POSITIONAL[@]}"

# if no provided environment name, use default env variable, then user override
if [[ ${ENV} = "" ]];
then
    ENV=${AWS_BRANCH}
fi

if [[ ${USER_BRANCH} != "" ]];
then
    ENV=${USER_BRANCH}
fi

# strip slashes, limit to 10 chars
ENV=$(echo ${ENV} | sed 's;\\;;g' | sed 's;\/;;g' | cut -c -10)

# Check valid environment name
if [[ -z ${ENV} || "${ENV}" =~ [^a-zA-Z0-9\-]+ ]] ; then help_output ; fi

AWSCONFIG="{\
\"configLevel\":\"project\",\
\"useProfile\":true,\
\"profileName\":\"default\",\
\"AmplifyAppId\":\"${AWS_APP_ID}\"\
}"
AMPLIFY="{\
\"envName\":\"${ENV}\",\
\"appId\":\"${AWS_APP_ID}\"\
}"
PROVIDERS="{\
\"awscloudformation\":${AWSCONFIG}\
}"
CODEGEN="{\
\"generateCode\":false,\
\"generateDocs\":false\
}"
CATEGORIES=""
if [[ -z ${AMPLIFY_FACEBOOK_CLIENT_ID} && -z ${AMPLIFY_GOOGLE_CLIENT_ID} && -z ${AMPLIFY_AMAZON_CLIENT_ID} ]]; then
-    CATEGORIES=""
+    AUTHCONFIG="{\
+   \"userPoolId\":\"${AMPLIFY_USERPOOL_ID}\",\
+    \"webClientId\":\"${AMPLIFY_WEBCLIENT_ID}\",\
+    \"nativeClientId\":\"${AMPLIFY_NATIVECLIENT_ID}\"\
+    }"
+    CATEGORIES="{\
+    \"auth\":$AUTHCONFIG\
+    }"
else
    AUTHCONFIG="{\
    \"facebookAppIdUserPool\":\"${AMPLIFY_FACEBOOK_CLIENT_ID}\",\
    \"facebookAppSecretUserPool\":\"${AMPLIFY_FACEBOOK_CLIENT_SECRET}\",\
    \"googleAppIdUserPool\":\"${AMPLIFY_GOOGLE_CLIENT_ID}\",\
    \"googleAppSecretUserPool\":\"${AMPLIFY_GOOGLE_CLIENT_SECRET}\",\
    \"amazonAppIdUserPool\":\"${AMPLIFY_AMAZON_CLIENT_ID}\",\
    \"amazonAppSecretUserPool\":\"${AMPLIFY_AMAZON_CLIENT_SECRET}\"\
    }"
    CATEGORIES="{\
    \"auth\":$AUTHCONFIG\
    }"
fi
# Handle old or new config file based on simple flag
if [[ ${IS_SIMPLE} ]];
then
    echo "# Getting Amplify CLI Cloud-Formation stack info from environment cache"
    export STACKINFO="$(envCache --get stackInfo)"
    init_env ${ENV} ${AMPLIFY} ${PROVIDERS} ${CODEGEN} ${AWSCONFIG} ${CATEGORIES}
    echo "# Store Amplify CLI Cloud-Formation stack info in environment cache"
    STACKINFO="$(amplify env get --json --name ${ENV})"
    envCache --set stackInfo ${STACKINFO}
    echo "STACKINFO="${STACKINFO}
else
    # old config file, above steps performed outside of this script
    init_env ${ENV} ${AMPLIFY} ${PROVIDERS} ${CODEGEN} ${AWSCONFIG} ${CATEGORIES}
fi

In addition, I added three environment variables to the Amplify Console (AMPLIFY_USERPOOL_ID, AMPLIFY_WEBCLIENT_ID, and AMPLIFY_NATIVECLIENT_ID) and wrote amplify.yml as follows

backend:
  phases:
    build:
      commands:
-         - '# Execute Amplify CLI with the helper script'
-         - amplifyPush --simple
+         - chmod u+x ./myamplifyPush.sh
+         - ./myamplifyPush.sh
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Any insight is always appreciated.

@OsenLiu
Copy link

OsenLiu commented Nov 24, 2020

I have the same issue with importing auth. I get it working with the script. It saved me.

@marcioibm
Copy link

marcioibm commented Dec 3, 2020

Got the same issue and the script fixed it! thanks!

@patrickcze
Copy link

Also am seeing the same issue

@morgler
Copy link

morgler commented Dec 6, 2020

Thanks for the script. Unfortunately it didn't work for me (my AMPLIFY_USERPOOL_ID and so on are still empty).

I hope the Amplify console team can adopt the CI/CD soon to the new amplify import auth feature.

@davegravy
Copy link

Also can confirm the same issue

@tfmorris
Copy link

tfmorris commented Dec 8, 2020

Just hit this issue as well. Two weeks and not even an acknowledgement from the AWS Amplify team?

@fujiwaka2408
Copy link
Author

@tfmorris No contact yet from AWS Amplify team.

@swaminator
Copy link
Contributor

swaminator commented Dec 9, 2020

@mlecoq
Copy link

mlecoq commented Dec 9, 2020

I have followed this one :

https://docs.amplify.aws/cli/auth/import

And all worked well except deployment in Amplify console as mentioned in this issue

@tfmorris
Copy link

tfmorris commented Dec 9, 2020

I did the same as @mlecoq. I'm importing/reusing a Cognito user pool defined in a different Amplify app.

@swaminator
Copy link
Contributor

@swaminator swaminator changed the title Amplify Console Backend Build Failure - auth headless init is missing the following inputParams userPoolId, webClientId, nativeClientId amplify import auth causes build failure - auth headless init is missing the following inputParams userPoolId, webClientId, nativeClientId Dec 9, 2020
@fujiwaka2408
Copy link
Author

@swaminator Yes, I have followed this instructions: https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#creating-a-new-backend-environment-with-authentication-parameters
As far as I can see from the documentation, userPoolId, webClientId, and nativeClientId are not available by default.

I added userPoolId, webClientId and nativeClientId to the environment variables from the Amplify Console and did amplifyPush --simple
However, the original shell script gives me the same error as the title.

So, I created myamplifyPush.sh, which adds userPoolId, webClientId, and nativeClientId to the original shell script.

@kevin-verschaeve
Copy link

Thanks for the workaround !

We also have the same issue after importing auth.

However, even the environment variables added into the custom script were not available for us, so we needed to add them manually (either in the amplify.yml build file, or in the amplify console).

@tfmorris
Copy link

@swaminator There's nothing on that page relevant to my configuration. I'm not using "social" signin, and besides, the auth config is totally defined in the user pool that I imported.

@kevin-verschaeve You need to define those environment variables yourself to use the workaround from @fujiwaka2408. It worked for me, but I have too many apps & environments to go around settings all those environment variables by hand, so I updated the script to figure out this information on its own.

Here's an improved workaround. If you add this line just before amplify init is called, it will recreate the auth info in the CATEGORIES variable. Note that this is probably NOT compatible with Google/FB/etc login environment variables (but I don't use any of those).

        CATEGORIES=$(node -e "const auths=Object.values(JSON.parse(process.argv[1]).categories.auth);console.log(JSON.stringify({'auth':auths[auths.length-1]}));" "$STACKINFO")

The actual bug is in the Amplify CLI in some combination of amplify env init and amplify init, but this will work around it.

@johnsorianodev
Copy link

resources is not created why I used this script.

@WolfyUK
Copy link

WolfyUK commented Jan 21, 2021

@guizler I modified amplify.yml to force an amplify push:

backend:
  phases:
    preBuild:
      commands:
        - chmod u+x ./scripts/amplify-push.sh
    build:
      commands:
        - ./scripts/amplify-push.sh
        - amplify push --yes
# ...

@damianthekreeeytor
Copy link

damianthekreeeytor commented Jan 24, 2021

For anyone else running into this issue, all I had to do is add the following Environment Variables in AWS Amplify console.

AMPLIFY_USERPOOL_ID
AMPLIFY_WEBCLIENT_ID
AMPLIFY_NATIVECLIENT_ID

I was receiving the same error when using amplify import auth.

@tfmorris
Copy link

@swaminator Has this been fixed? What version of the Amplify CLI has the fix?

@FredrikMeyer
Copy link

I fixed this by following @damianthekreeeytor 's advice, but had to add an environment variable for the identity pool as well:
bilde

I could not find any mention of these variables in the documenation.

@glynjackson
Copy link

Why is this closed??? This issue is still not resolved in 4.42.0 for me. Thank you @fujiwaka2408 for posting a workaround.

@vic-blt
Copy link

vic-blt commented Feb 18, 2021

If you have an amplify backend and frontend, it means you need your app to be detected as fullstack.
If Framework in App details equals to

  • React ➡️ not fullstack
  • React - Amplify ➡️ fullstack

In order to have a fullstack amplify app, see my comment #448 (comment)
Then define these 4 environment variables

AMPLIFY_IDENTITYPOOL_ID
AMPLIFY_NATIVECLIENT_ID
AMPLIFY_USERPOOL_ID
AMPLIFY_WEBCLIENT_ID

Now you can deploy 😸

@j8jacobs
Copy link

what exactly is the AMPLIFY_NATIVECLIENT_ID? It looks like from the screenshot above in @FredrikMeyer post it could be the same as the AMPLIFY_AMAZON_CLIENT_ID, but I don't know where that value is coming from either

@FredrikMeyer
Copy link

what exactly is the AMPLIFY_NATIVECLIENT_ID? It looks like from the screenshot above in @FredrikMeyer post it could be the same as the AMPLIFY_AMAZON_CLIENT_ID, but I don't know where that value is coming from either

I think it is one of the user pool clients. The one with a generated password.

@vic-blt
Copy link

vic-blt commented Mar 11, 2021

@FredrikMeyer you're right, it's the id of the app client which has a generated secret.

@WolfyUK
Copy link

WolfyUK commented Mar 15, 2021

Just a heads up: After moving the app to a monorepo the Amplify Console builds started inexplicably failing again for me without any related changes to the .yml nor environment variables.

@Stf-F
Copy link

Stf-F commented Apr 12, 2021

The issue still exists in 4.46.1 and the fix is the same as before: adding environment variables in the Amplify Console.

tjrunnels added a commit to ForwardTech-Solutions/prayerSaaS that referenced this issue Jun 17, 2021
@jaubrey-ebar
Copy link

Any suggestions on how to make this work for multiple environments?

Setting the 3 environment variables (AMPLIFY_USERPOOL_ID, AMPLIFY_NATIVECLIENT_ID, AMPLIFY_WEBCLIENT_ID) was enough to get a continuous integration build working with CodeCommit. However, I have multiple environments (i.e. dev, beta, prod) and I'm trying to figure out how to have different values for each environment - currently they share the same environment variables.

My amplify/team-provider-info.json file has an auth section per environment with attributes corresponding to the environment variables mentioned above (userPoolId, nativeClientId, webClientId). If amplify would use these values we would not need the environment variables and it would solve my issue of how to make this work for multiple environments. A suggestion to work around this amplify bug/missing-feature would be appreciated.

@jaubrey-ebar
Copy link

I'll answer my own question here. Three solutions are ranked from best to worst:

  1. Amplify is improved so the following aren't necessary.

  2. Invoke a script from amplify.yml. This way you can parse the amplify/team-provider-info.json to extract the settings and set them in the environment. The settings are now only in one place.

  3. If you're ok with the same settings in amplify/team-provider-info.json and the Amplify Console: When setting an environment variable via the Amplify Console, there's an option in the 'Action' dropdown to select 'override' to set a value per environment.

@PabloLION
Copy link

PabloLION commented Sep 20, 2021

I removed then imported a new auth then encountered the same problem.
following damianthekreeeytor's answer I get it sovled.
The value for these ENV VARs can be found in Admin UI
image

@jeffie9
Copy link

jeffie9 commented Sep 29, 2021

Amplify version 6.1.0 - still broken.

@DonDebonair
Copy link

I unsubscribed to this issue because I'm so blissfully happy with Vercel

@thejimmyg
Copy link

I just started a new Amplify project following these instructions https://docs.amplify.aws/cli/auth/import/ to test importing from an existing Cognito user pool and also hit the same problem.

At the very least the documentation should be updated to explain the problem and the workaround.

@kbokarius
Copy link

kbokarius commented Nov 15, 2021

I just ran into the same issue and adding the environmental variables seems to have resolved it.

However, I'm now seeing this error:

There was an error initializing your environment.
[ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

I'm running a React app on the frontend. Is there another missing env var?

Full trace:

[0m    at validateString (internal/validators.js:120:11)�[0m
                                 �[0m    at Object.join (path.js:1039:7)�[0m
                                 �[0m    at PathManager.constructPath (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/pathManager.ts:253:34)�[0m
                                 �[0m    at PathManager.getResourceDirectoryPath (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/pathManager.ts:142:10)�[0m
                                 �[0m    at PathManager.getResourceParametersFilePath (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/pathManager.ts:149:34)�[0m
                                 �[0m    at StateManager.setResourceParametersJson (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/stateManager.ts:284:34)�[0m
                                 �[0m    at updateStateFiles (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:728:16)�[0m
                                 �[0m    at Object.headlessImport (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:1277:26)�[0m
                                 �[0m    at processTicksAndRejections (internal/process/task_queues.js:97:5)�[0m
                                 �[0m    at importedAuthEnvInit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:946:12)�[0m
                                 �[0m    at updateConfigOnEnvInit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/index.js:52:72)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/index.js:349:22 {�[0m
                                 �[0m  code: 'ERR_INVALID_ARG_TYPE'�[0m

@OskarD
Copy link

OskarD commented Nov 16, 2021

I just ran into the same issue and adding the environmental variables seems to have resolved it.

However, I'm now seeing this error:

There was an error initializing your environment.
[ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

I'm running a React app on the frontend. Is there another missing env var?

Full trace:

[0m    at validateString (internal/validators.js:120:11)�[0m
                                 �[0m    at Object.join (path.js:1039:7)�[0m
                                 �[0m    at PathManager.constructPath (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/pathManager.ts:253:34)�[0m
                                 �[0m    at PathManager.getResourceDirectoryPath (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/pathManager.ts:142:10)�[0m
                                 �[0m    at PathManager.getResourceParametersFilePath (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/pathManager.ts:149:34)�[0m
                                 �[0m    at StateManager.setResourceParametersJson (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/state-manager/stateManager.ts:284:34)�[0m
                                 �[0m    at updateStateFiles (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:728:16)�[0m
                                 �[0m    at Object.headlessImport (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:1277:26)�[0m
                                 �[0m    at processTicksAndRejections (internal/process/task_queues.js:97:5)�[0m
                                 �[0m    at importedAuthEnvInit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:946:12)�[0m
                                 �[0m    at updateConfigOnEnvInit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/provider-utils/awscloudformation/index.js:52:72)�[0m
                                 �[0m    at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-auth/src/index.js:349:22 {�[0m
                                 �[0m  code: 'ERR_INVALID_ARG_TYPE'�[0m

I have this problem too now. There are two open issues for this problem: #2306 #2251

@kbokarius
Copy link

Fortunately I was able to simply create a new Cognito pool to workaround the issue. I'm nevertheless always amazed at the lack of consistency and support of AWS technologies despite its overall success.

@SriniSanthanam-energism

Facing the same issue "The "path" argument must be of type string. Received undefined". Did you create the new user pool using aws cli or directly through aws console? I presume you must have set the environment variables accordingly afterwards to build the CI/CD using amplify

@julienlaurent-migso
Copy link

Hello, we are facing the exactly same issue when imported an existing auth.
We fixed the first issue added the environment variables in the amplify console.
But the "path" issue is still blocking us... We tried to deploy or application with lot of node, amplify/cli versions but nothing fix the issue. Someone could help us ?

@ghost
Copy link

ghost commented Nov 23, 2021

Hi 👋🏽 @SriniSanthanam-energism @julienlaurent-migso @OskarD @kbokarius - apologies for the delay.

For anyone running into the "path" argument must be of type string error, can you please make sure that the parameters.json file generated when importing auth has the correct file path? It should be amplify/backend/auth/appXXXXXX/parameters.json

Ref: Related CLI Issue

@OskarD
Copy link

OskarD commented Nov 23, 2021

@hloriana since not even AWS Premium Support was able to help me in over a week's time, I today decided to delete the whole project and start all over again. It worked as long as I used the CLI to create and configure everything (Very labor intensive), until I added a simple default API and it suddenly couldn't push. I committed my Amplify changes to my repository, and the build server managed to deploy my Amplify configuration - so that was good.

But now that I tried to set up the data modeling in the Amplify Admin UI, it tells me "auth headless is missing the following inputParams googleClientId.". I know I put it in the CLI when I added the Amplify Authentication configuration, and I know it's defined as an environment variable in my build environment, but I guess this thing has its own unconfigurable environment that doesn't use any of those?

I'm starting to feel like I would have been better off using Vercel or just straight up a Raspberry Pi for deploying my product at this point. I wish you guys would make at least either the CLI or the UI work properly. Then I wouldn't have to spend half my development time trying to figure out all your edge cases and workarounds for bugs.

I was hoping Amplify would be a way to speed up my development process, but I'm starting to feel that I'm just a beta tester for a 4 year old product that is never going to be ready for release. Maybe that's why it's released?

I mean honestly, is my user flow such an anomaly? A JS web app that has Cognito and DataStore? I feel like that should be the type of project that Amplify was built for from the beginning. If this doesn't work, does anything?

@ghost
Copy link

ghost commented Nov 24, 2021

Hi @OskarD, thank you for providing your feedback on your experience with Amplify. We understand that you've experienced delays of increased development times and we would like to schedule a call with you to expedite solving the data modeling error with the Admin UI. Please reach out to aws-amplify-customer@amazon.com with your information so we can further assist you.

@chittasec
Copy link

I faced the same issue .I can only say that Amplify Sucks. Every step there is failure . Going to use Firebase for my app , better .

@ivantichy
Copy link

The same issue here. Why is this issue closed?

@swaminator swaminator reopened this Jan 12, 2022
@swaminator
Copy link
Contributor

@ivantichy @chittasec we have reopened the issue.

@NivBraz
Copy link

NivBraz commented Feb 10, 2022

same issue for me, is there anything better then this script ?

@ENT108
Copy link

ENT108 commented Mar 15, 2022

If you have an amplify backend and frontend, it means you need your app to be detected as fullstack. If Framework in App details equals to

  • React ➡️ not fullstack
  • React - Amplify ➡️ fullstack

In order to have a fullstack amplify app, see my comment #448 (comment) Then define these 4 environment variables

AMPLIFY_IDENTITYPOOL_ID
AMPLIFY_NATIVECLIENT_ID
AMPLIFY_USERPOOL_ID
AMPLIFY_WEBCLIENT_ID

Now you can deploy 😸

Does it mean I can't fix it while running only backend on Amplify? I have tried pretty much everything already except turning the app to fullstack.

@cydharttha
Copy link

Ran into this with non-Amplify-console CI/CD as well (Gitlab). Had to add --categories with auth config detail to the build script. I'm surprised this info can't be pulled from team-provider-info.json.

@Bohemus307
Copy link

Bohemus307 commented Oct 6, 2022

Still An issue with no current fix from either the Amplify team or AWS support. Is there any hope on this? @swaminator

@alexjball
Copy link

@fauzanelka
Copy link

fauzanelka commented Oct 25, 2022

This issue still happens to me, I don't want to push amplifyPush.sh into my repository so I just add this line in amplify.yml

version: 1
applications:
  - backend:
      phases:
        build:
          commands:
            - '# Execute Amplify CLI with the helper script'
            - sed -i '102s/CATEGORIES=""/CATEGORIES="{\\"auth\\":{\\"userPoolId\\":\\"${AMPLIFY_USERPOOL_ID}\\",\\"webClientId\\":\\"${AMPLIFY_WEBCLIENT_ID}\\",\\"nativeClientId\\":\\"${AMPLIFY_NATIVECLIENT_ID}\\"}}"/g' $(which amplifyPush)
            - amplifyPush --environment staging --simple

@danny33118
Copy link

danny33118 commented Jan 11, 2024

My problem was
Screenshot 2024-01-11 at 10 45 38 AM
when sign-in or sign-up with google.

causes :
in aws-export.js
oauth: {
domain: "xxxxxx-dev.auth.ap-southeast-1.amazoncognito.com",
scope: ["phone", "email", "openid", "profile", "aws.cognito.signin.user.admin"],
redirectSignIn: "http://localhost:3000/oauth2/idpresponse/,http://example.com/oauth2/idpresponse/",
redirectSignOut: "http://localhost:3000/",
responseType: "token",
},

solution:
oauth: {
domain: "xxxxxx-dev.auth.ap-southeast-1.amazoncognito.com",
scope: ["phone", "email", "openid", "profile", "aws.cognito.signin.user.admin"],
redirectSignIn: "http://localhost:3000/oauth2/idpresponse/",
redirectSignOut: "http://localhost:3000/",
responseType: "token",
},

  • or -
    oauth: {
    domain: "xxxxxx-dev.auth.ap-southeast-1.amazoncognito.com",
    scope: ["phone", "email", "openid", "profile", "aws.cognito.signin.user.admin"],
    redirectSignIn: "https:///oauth2/idpresponse",
    redirectSignOut: "http:/yourdomain.com/signout-anylandingpage/",
    responseType: "token",
    },

solution 2(no modification of aws-export.js):
just add these to app.js :-
awsExports.oauth.redirectSignIn = ${window.location.origin}/oauth2/idpresponse/;
awsExports.oauth.redirectSignOut = ${window.location.origin}/;
Amplify.configure(awsExports);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests