aws-amplify / amplify-cli

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

Getting build "There was an issue connecting to your repo provider.." error #11856

Closed MarioStipetic closed 1 year ago

MarioStipetic commented 1 year ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

``` # Put output below this line System: OS: macOS Sierra 10.12.6 CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz Memory: 107.70 MB / 8.00 GB Shell: 3.2.57 - /bin/sh Binaries: Node: 16.17.1 - /usr/local/bin/node npm: 8.15.0 - /usr/local/bin/npm Browsers: Chrome: 103.0.5060.134 Safari: 12.1.2 npmPackages: @aws-amplify/ui-react: ^4.3.4 => 4.3.4 @aws-amplify/ui-react-internal: undefined () @createnextapp/async-local-storage: ^1.0.1 => 1.0.1 @stripe/stripe-js: ^1.46.0 => 1.46.0 @testing-library/jest-dom: ^5.16.5 => 5.16.5 @testing-library/react: ^13.4.0 => 13.4.0 @testing-library/user-event: ^13.5.0 => 13.5.0 aws-amplify: ^5.0.11 => 5.0.11 axios: ^1.2.2 => 1.2.2 (0.26.0, 0.26.1) body-parser: ^1.20.1 => 1.20.1 cors: ^2.8.5 => 2.8.5 express: ^4.18.2 => 4.18.2 jquery: ^3.6.1 => 3.6.1 mdb-react-ui-kit: ^5.0.0 => 5.0.0 openai: ^3.1.0 => 3.1.0 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 react-image-picker: ^1.1.1 => 1.1.1 react-router-dom: ^6.4.2 => 6.4.2 react-scripts: 5.0.1 => 5.0.1 web-vitals: ^2.1.4 => 2.1.4 npmGlobalPackages: @aws-amplify/cli: 10.5.2 corepack: 0.12.1 create-react-app: 5.0.1 npm: 8.15.0 ```

Describe the bug

Getting the following error when trying to build the app "There was an issue connecting to your repo provider, click "Reconnect repository" in General Settings, and then try your build again.".

When I remove Google Authentication everything works fine, I can build the app.

image

I make a amplify pull request with every Google Authentication change

Two days ago, the similar build error appear (I had both googleAppIdUserPool, googleAppSecretUserPool added to the Studio Authenticate section) : "2023-01-25T23:12:23.088Z [WARNING]: - Building resource xxxxx 2023-01-25T23:12:23.178Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud. 2023-01-25T23:12:23.191Z [WARNING]: ✖ There was an error initializing your environment. 2023-01-25T23:12:23.200Z [INFO]: 🛑 Could not initialize categories for 'dev': auth headless is missing the following inputParams googleAppIdUserPool, googleAppSecretUserPool 2023-01-25T23:12:23.200Z [INFO]: Resolution: Review the error message and stack trace for additional information. Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/"

Expected behavior

I want to be able to use the Google Amplify oAuth and build the app!

Reproduction steps

  1. Google oAuth is not activated -- Build works
  2. Activate Google oAtuh -- build does not work ( "There was an issue connecting to your repo provider, click "Reconnect repository" in General Settings, and then try your build again.". )
  3. I delete the Google oAuth from the Authentication screen in Amplify studio and make a pull request -- Build works

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line .... latest attempt stopped at Cloning repository: 2023-01-26T00:27:11.188Z [INFO]: Successfully cleaned up Git credentials 2023-01-26T00:27:11.189Z [INFO]: # Checking for Git submodules at: 2023-01-26T00:27:11.199Z [INFO]: # Retrieving environment cache... 2023-01-26T00:27:11.760Z [INFO]: # Retrieved environment cache 2023-01-26T00:27:11.760Z [INFO]: ---- Setting Up SSM Secrets ---- 2023-01-26T00:27:11.760Z [INFO]: SSM params {"Path":"/amplify/d2xdbl2vtd0mkx/dev/","WithDecryption":true} 2023-01-26T00:27:22.349Z [INFO]: # Node version 14 is available for installation 2023-01-26T00:27:22.430Z [INFO]: # Installing Node version 14 2023-01-26T00:27:29.059Z [INFO]: # Now using Node version 14 2023-01-26T00:27:30.104Z [WARNING]: Cannot find module '/root/.nvm/versions/node/v14.21.2/lib/node_modules/@aws-amplify/cli/package.json' Require stack: - /snapshot/AWSMobilePioneerExecute/out/index.js 2023-01-26T00:27:30.105Z [INFO]: # Patching NPM package '@aws-amplify/cli' to 10.6.2... 2023-01-26T00:27:50.803Z [INFO]: # Done patching NPM package '@aws-amplify/cli' to version 10.6.2 ironment caching... 2023-01-26T00:28:13.512Z [INFO]: # Uploading environment cache artifact... 2023-01-26T00:28:13.655Z [INFO]: # Uploaded environment cache artifact 2023-01-26T00:28:13.655Z [INFO]: # Environment caching completed Terminating logging... ---------- Earlier attempt stopped at backend (I was editing the google auth options in the Studio Authentication section): 2023-01-25T23:12:23.086Z [INFO]: ✅ GraphQL schema compiled successfully. Edit your schema at or place .graphql files in a directory at 2023-01-25T23:12:23.088Z [WARNING]: - Building resource auth/xxx 2023-01-25T23:12:23.178Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud. 2023-01-25T23:12:23.191Z [WARNING]: ✖ There was an error initializing your environment. 2023-01-25T23:12:23.200Z [INFO]: 🛑 Could not initialize categories for 'dev': auth headless is missing the following inputParams googleAppIdUserPool, googleAppSecretUserPool 2023-01-25T23:12:23.200Z [INFO]: Resolution: Review the error message and stack trace for additional information. Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/ 2023-01-25T23:12:23.202Z [INFO]: 2023-01-25T23:12:23.202Z [INFO]: Session Identifier: xxxx 2023-01-25T23:12:23.316Z [ERROR]: !!! Build failed 2023-01-25T23:12:23.316Z [ERROR]: !!! Non-Zero Exit Code detected 2023-01-25T23:12:23.317Z [INFO]: # Starting environment caching... 2023-01-25T23:12:23.317Z [INFO]: # Uploading environment cache artifact... 2023-01-25T23:12:23.425Z [INFO]: # Uploaded environment cache artifact 2023-01-25T23:12:23.425Z [INFO]: # Environment caching completed Terminating logging... ```

aws-exports.js

const awsmobile = { "aws_project_region": "us-east-1", "aws_appsync_graphqlEndpoint": "xxxxxxx, "aws_appsync_region": "us-east-1", "aws_appsync_authenticationType": "API_KEY", "aws_appsync_apiKey": "xxxxxxxx", "aws_cognito_identity_pool_id": "xxxxxxx", "aws_cognito_region": "us-east-1", "aws_user_pools_id": "xxxxxx", "aws_user_pools_web_client_id": "xxxxxxxx", "oauth": { "domain": "xxxxxxx", "scope": [ "phone", "email", "openid", "profile", "aws.cognito.signin.user.admin" ], "redirectSignIn": "https://xxx/signin-success", "redirectSignOut": "https://xxx/signout", "responseType": "code" }, "federationTarget": "COGNITO_USER_POOLS", "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [ "GOOGLE" ], "aws_cognito_signup_attributes": [ "EMAIL" ], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [ "SMS" ], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 6, "passwordPolicyCharacters": [] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ] };

export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

tannerabread commented 1 year ago

@MarioStipetic I will transfer this to the CLI repo so they can assist you better

josefaidt commented 1 year ago

Hey @MarioStipetic :wave: thanks for raising this! As we begin to look into this in more depth, can you clarify whether the AMPLIFY_GOOGLE_* environment variables are added to Amplify Hosting?

https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#amplify-console-environment-variables

MarioStipetic commented 1 year ago

hi @josefaidt

yes, thank you! I managed to fix the issue by reading those two pages: https://github.com/aws-amplify/amplify-js/issues/7194 https://ntalam.com/2022/02/10/aws-amplify-error-headless-is-missing-the-following-inputparams/

Here is the solution:

image

In my opinion, this is a bug; why does Amplify automatically not add those environment variables?

How would I supposed to know that?

I never heard about that, lost one day because of this AWS Amplify bug.

josefaidt commented 1 year ago

Hey @MarioStipetic glad to hear that resolved the issue for you, and apologies for the rough experience! I agree with you in that this should be a smoother experience, and as such I've added the ops-auth label to this to track this pain point alongside our efforts to improve this workflow!

For now, I'll close this issue in favor of tracking some of our existing items under the auth and ops-auth labels.