I am using firebase with react native . Trying to write some firebase cloud functions. For that i have used firebase init . On console it gives a success message but the function folder is not been created in my project .
I have tried several times re initializing the firebase init but no result.
Try a new folder location. Create a new folder by the name of the backend wherever you'd like and 'CD' into it before you initialize it. i.e. users/haseeb/project and see if it then creates it.
Then, move the functions folder to the root level of the project.
Related
Most of our client projects have a very similar starting point:
Pristine AWS account used only for a single environment for this application
GraphQL API and a basic model to start with
A REST API with an OAuth handler endpoint and a generic webhook listener endpoint, each with a corresponding Lambda function (with code for each)
I've created this basic amplify app and I want to create a repo with this general structure as a starting point for future projects. The idea being that I'd copy the contents of the repo when starting a project and build from there.
So I've copied the entire amplify directory over to a new location, removing everything that is in the amplify section of the .gitignore file, and I have a folder structure like this:
My steps to start a new project are:
Create a new directory
Copy the template repo files into this directory
run amplify init
Once I do that, it creates two additional files:
amplify/.config/project-config.json
amplify/team-provider-info.json
Then, I try to do amplify push -- but I get No changes detected.
I'm not even sure if what I'm doing is possible -- I was wondering if anyone else has tried this?
i am trying to deploy my project on firebase hosting. And whenever i am using firebase init it is showing error in terminal as "firebaserc already has a default project " and it exit with that error
i have tried firebase logout and firebase login again . And used "firebase use" command also to change the project but it is still performing the firebase init action on the default project
i want to remove that default project
If you look very carefully at the messaging, it's saying that the name of the file is ".firebaserc" with a leading dot. This file indicates that firebase init was already run in this folder, and the contents of that file describe which project it's connected to (flairboat-48f7b). If you no longer want that file, delete it and start over. Since it starts with a dot, it might be hidden from normal view, but you can be sure that it exists.
you should write:
firebase use --add
and it work! You get the option to choose the preject from firebase.
I ran into the same issue.
Due to a small mistake in setting up the project in firebase, I had to delete it.
But later, I realized that my application NEEDS the default project to be hosted from firebase.
Since I found no shortcuts and running out of time, I did "this" to fix the issue in 10 minutes...with a 5-Step-Process. This is not a "Clever tip". But if you want things up and running soon, you can try this...
Create a new project (in my case, it's React project in VS Code IDE) using - npx create-react-app newprojectname to create a new react project with a different file name.(Don't delete or replace your previous project yet... )
While the new project is being created, create a new project in firebase to host your project.
Copy the folder from your old project that has all your work (it's "src" folder in case of React) and replace the "src" folder in the new project you created in your local machine.
Install all dependencies...Don't forget to add any dependencies you added to you old project. Look at the package.json file of the old project and import all dependencies.
Hit the start command (npm start in my case) and see your project running.
*I'll update if I found some firebase secret to resolve this issue. You can look for the same.
Ensure your firebase project support email and firebase initialize login email are same. If different? It won't be worked. so you must ensure it that two email (firebase project support email and firebase initialize email) are same.
Command $firebase init functions after processing is not asking for my project id at firebase which should be initialized, instead it is using default project. Here is the picture
It is because you are reinitializing the firebase functions in the current directory i.e. learning chatbots.
If you intend to overwrite the existing firebase functions in this directory you can follow these instructions:
OR if don't want to overwrite existing files:
It will be better if you create a new directory and then initialize firebase functions there.
Make a new directory outside of "learning chatbots" directory and
try initializing there.
I hit following problem working with firebase functions, I split functionality into different files, few of them have only custom utility logic.
The thing is that with firebase CLI I only can upload separate functions with :
firebase deploy --only functions:someFunction
But in this case the utility file which function someFunction uses does not get uploaded. To refresh logic in separate files I need to redeploy all the functions by executing :
firebase deploy functions
and I hit deployment limit just in few deploys.
Is there any way I can redeploy a separate file to the server?
UPD
By utility file I mean files that contain logic and used in functions. Say we have function someFunction in the index.js that goes like this :
const commons = require('./commons');
exports.someFunction = function() {
common.sayHello();
}
In this case commons is a plain javascript file (commons.js) that has utility functions, other words - utility file.
exports.sayHello = function() {
console.log('hello!');
}
This is exactly the file I would like to redeploy separately.
It's not possible to upload only a single file when when deploying functions. The entire contents of the functions folder (except node_modules) is replaced for every function at every deployment, even if you are deploying just one function at a time.
I have two different react apps - one admin app and another client app. The two apps share the same Firebase database and now I want to deploy both of them to Firebase hosting so that I can access them from two different URLs.
To do this I followed the following approach:
Type firebase init
Type firebase deploy
This works fine, but the issue is that when I deploy my second project it overwrites the URL for my first project.
I tried adding another project in the firebaserc file so that it looks like:
{
"projects": {
"default": "fire-app-9c444",
"project1": "fire-app-9c444-admin",
"project2": "fire-app-9c444-mobile"
}
}
running firebase use then lists the projects as
* default (fire-app-9c444)
project1 (fire-app-9c444-admin)
project2 (fire-app-9c444-mobile)
But I cannot change to project1 or project2. If I write firebase use project1 I get the following error:
Error: Unable to use alias project1, please verify project
fire-app-9c444-admin exists and you have access.
Any ideas how to go about this?
I had the same error. In my case my project1 app was created with a different Google account as my project2 app. I just added the other Google account as a maintainer in my Firebase project settings (https://console.firebase.google.com/project/${projectName}/settings/iam). Now I can switch projects with firebase use ${projectName}
With firebase login you can check which Google account you are currently logged in