How Can I Debug Updating The API In AWS Amplify CLI - aws-amplify

Use-Case:
I would like to add a new field of hasLogo: Boolean to my AWS Amplify project in the graphql.schema. This will be the only change to the whole project.
Steps:
Pull latest version of AWS Amplify
Change the graphql.schema by only adding hasLogo: Boolean to my type.
Go to S3 deployment folder and delete the deployment-state.json
Run amplify push in the CLI
Amplify Status Before Typing "y" in the CLI:
Amplify Error Message:

Related

Google Cloud Build & Firebase Deploy - "An unexpected error has occurred"

I'm using Google Cloud Build to do a deployment to Firebase Hosting when a commit is on master. I'm using the Firebase Cloud Builder, deployed to my project. I've checked permissions in the Cloud Console and Firebase access is enabled.
Everything seems to go well in generating the static HTML for hosting, but at the final build step it fails suddenly with this problem:
Error: An unexpected error has occurred.
Here is the step in my cloudbuild.yaml that fails:
- name: gcr.io/$PROJECT_ID/firebase
args: ['deploy', '--project', '$PROJECT_ID']
id: Deploy to Firebase
The last time that I installed the container was in October. The "An unexpected error has occurred" was solved by others by updating their version of the Firebase CLI. I had to do the same thing in my CD environment in order to get this to work.
Following these instructions in the README:
cd cloud-builders-community/firebase
gcloud builds submit --config cloudbuild.yaml .
The Firebase CLI version was reinstalled and published to my project. Then I was able to retry the build and it worked successfully.
This tripped me up for about an hour yesterday, and I thought it may be helpful to just have the answer documented somewhere.

Where to run gcloud init?

Need to access some gcloud functions in a react project. Should I run gcloud init in the project root folder or within the firebase functions/ folder? Will it interfere with firebase deploy for the functions?
Following this: https://medium.com/#nedavniat/how-to-perform-and-schedule-firestore-backups-with-google-cloud-platform-and-nodejs-be44bbcd64ae
I already have some other firebase functions set up which I would deploy with firebase deploy --only functions. When I got to step 5 of the above tutorial, I got a gcloud command not found. I followed the instructions here: https://cloud.google.com/sdk/docs/#install_the_latest_cloud_tools_version_cloudsdk_current_version
and when it got to step 5 in that, I presume I should be doing it somewhere in the project folder to use that project's specific login? Without running it I get the following error when trying to use:
gcloud functions deploy backup --runtime nodejs8 --trigger-topic YOUR_TOPIC_NAME_HERE
ERROR: (gcloud.functions.deploy) Error parsing [name].
The [function] resource is not properly specified.
Failed to find attribute [project]. The attribute can be set in the following ways:
- provide the argument [--project] on the command line
- set the property [core/project]
The error message is clear. Add --project <project id> at the deploy command or perform a gcloud config set project <project id>.
If you use only firebase, firebase has automatically create a GCP project. Go to https://console.cloud.google.com to view your project name or ID. I think it's also possible to view this information in firebase console.

Firebase and Gitlab continuous integration pipeline failing

I am trying to hook up a simple static website to firebase hosting from Gitlab using their continuous integration tab. After downloading and installing firebase command line tools I am here:
stages:
- deploy
deploy-prod:
stage: deploy
only:
- master
script:
- firebase use <project-name> --token $FIREBASE_TOKEN
- firebase deploy --only hosting -m "Pipe $CI_PIPELINE_ID Build $CI_BUILD_ID" --token $FIREBASE_TOKEN
After that in firebase I deploy the site. However, gitlab then reports that the job is not deployed because
Error: firebase use must be run from a Firebase project directory.
Run firebase init to start a project directory in the current folder.
I dont understand the error, as I have in fact run firebase in the project director. Or is the error referring to the image thats in the yml file?
Either way, could someone please help me out? I've found a number of blog posts using CI in gitlab with firebase but I am stuck.
I got same issue and solved it by check folder structure
in my case:
/root/xx_project
firebase.json is in xx_project
so I need to cd xx_project

'Firebase init' command didn't create package.json, index.js and function folder

I’m now trying to create a tutorial app for my Google Home but I faced some trouble. According to this tutorial, I finished following steps of Build fulfillment.
1.Download and install Node.js.
2.npm install -g firebase-tools
3.firebase login
4-1.mkdir sillynamemaker
4-2.cd sillynamemaker
4-3.firebase init
5.select Functions:…
6.select action project(silllynamemaker-***)
7.firebase init
But after step 7, there were only ‘firebase.json’ in current folder, so I couldn’t see functions folder, package.json and index.js.
My console log is below.
$ node -v
v8.6.0
$ npm --version
5.3.0
$ firebase --version
3.13.1
$ firebase init
You're about to initialize a Firebase project in this directory: ~/ghome/sillynamemaker
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm your choices.
⚠ You have have not selected any features. Continuing will simply associate this folder with a Firebase project. Press Ctrl + C if you want to start over.
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Select a default Firebase project for this directory: SillyNameMaker (sillynamemaker-*****)
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
✔ Firebase initialization complete!
I'm really glad if someone help me.
Thanks in advance.
You must select features you want to initialize by using the arrow keys and spacebar -- none are on by default. See the error message in your pasted log:
⚠ You have have not selected any features. Continuing will simply associate this folder with a Firebase project. Press Ctrl + C if you want to start over.
You can also run firebase init functions to specifically initialize only functions.

Changing target Firebase ID using firebase-tools CLI

At the command line...
When I run firebase deploy, I get the following error:
Error: The entered credentials were incorrect.
When I run firebase deploy --debug, I get the following (more detailed) error (and log) shown when you click here. (firebase-debug.log)
When I run firebase deploy --project good-project-id, I get the expected deployment behavior.
When I rerun firebase deploy and firebase deploy --debug I get the same errors already described.
How do I make the proper changes to eliminate the errors when running firebase deploy?
Notes:
I am running Mac OS/X Yosemite v10.10.5
I just ran the NPM installation procedure (via Homebrew) described here.
Look at the contents of your .firebaserc file in your project directory. You likely have a "default" project alias specified. Run firebase list and see if that project id shows up there as well (note it should be the project id, not the instance/subdomain name).
If it doesn't match, that's likely your issue. Another thing you can try is deleting the .firebaserc file and then running firebase use --add to create a new project alias.

Resources