Flutter: I am getting an outdated message when trying to launch - firebase

Hey can someone help me I followed a tutorial from about 2 years ago to make a login/auth page that links with firebase. I tried to run the app at the end and it opens launch.json and asks for a configuration. Here is the code it wants me to add a config to.
"version": "0.2.0", "configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}
Here is the link to the tutorial github. Is there any way I can fix it to run now? https://github.com/tattwei46/flutter_login_demo

launch.json is a VSCode file that stores different build methods for your workspace. It's not really related to your flutter project setup. Allow VSCode to add the config to the file and it should work fine. If launching using VSCode shortcuts is not necessary, you can just do flutter run.
You can read more about this file here. This doc uses a different language as an example, however, this doesn't matter as the file is for VSCode, not flutter/dart.

I recommend you to create new flutter project then copy flutter_login_demo lib into the new flutter project lib with pakages in yaml and images if icluded. its better becuase you may get extra errors like android X error .

Related

Build Next.js app before deploying via Serverless Component

We're using the Next.js Serverless Component from: https://serverless-nextjs.com/ to deploy our Next.js app to AWS using the Serverless framework.
It takes around 7-8 mins for the app to be built and then deployed to AWS.
We were hoping to instead build the app up-front and then deploy the pre-built code...
You can tell Serverless to not build and just do the deployment with build.enabled: false:
# serverless.yml
myNextApplication:
component: "#sls-next/serverless-component#3.7.0"
inputs:
bucketName: our-bucket-name
build:
enabled: false
However when we run yarn next build the app is built under ./next.
When serverless builds the app it stores the state in .stateless and the files in .stateless_nextjs. So therefore the next build isn't compatible with deploying a prebuilt app...
This means if we try and build the app and then call serverless after we get the following error:
myNextApplication › Error: ENOENT: no such file or directory, open '/Users/cameron/Projects/nextjs-serverless/.serverless_nextjs/default-lambda/manifest.json'
So how do you build the app first and then deploy the build using Next.js Serverless Component?
Versions:
"dependencies": {
"next": "12.2.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"serverless": "2.72.2"
},
component: "#sls-next/serverless-component#3.7.0"
The reason is probably wrong next.js middleware setup. manifest.json is built upon simulated requests that goes through nextjs middlewares. please refer to this stackoverflow answer.
nextjs middleware had some structural changes around v12.x that requires migration. it's hard to figure out what's wrong because it gives little or no warning messages and it builds okay. I had similar issues too.
Solution
check if your deploy includes proper package lock file(yarn.lock, package-lock.json...) so that fixed version of next.js is included when deploying.
check latest middleware examples from github repo and try match middleware file structure and code.
check out nextjs middleware migration guide mentioned earlier; try build in local environment and make sure manifest.json is created.

Connecting Firebase with NativeScript

So i installed firebase with adding the "google-services.json" in the App_Resources/Android folder.
After that i used the cli for the cmd: "tns plugin add #nativescript/firebase".
And it was successfull.
But if i try to use "firebase.firestore()" i get the message that firestore is unknown.
Yes i have ticked yes in the installation as it asked me if i want firestore.
So it should be useful but it is not.
I deleted the "firebase.nativescript.json" and run the 'npm run config' command in the android folder but it didnt help.
Then I uninstalled the plugin with "tns plugin remove #nativescript/firebase" and re-installed it.
Nothing works. Here is my fire in #nativescript:
Is there a Solution?
You should be able to import firestore directly from #nativescript/firebase and access its properties that way
import { firestore } from '#nativescript/firebase';
// firebase.firestore().collection('user') becomes the following line
firestore.collection('user')

Unable to change the default project to deploy my project on firebase hosting

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.

How to deploy to Azure Resource Group using VSTS release management

I am new to Visual Studio Team Services Release Management. My goal is to automate a deployment of an ASP.NET MVC application to the Azure App Service.
Trying different approaches, I created a Service Endpoint that is certificate based and one that uses a service principal (SPN). My build definition already builds a web deploy package, and the release definition is linked against that and can use this artifact.
Success 1:
A deployment of the app using the Azure Web App Deployment Task already succeeded - almost.
Shortcoming 1: I do not understand how I can specify the correct Resource Group using this task. This uses the certificate based endpoint, and for this task I cannot use the other (SPN) endpoint.
Success 2:
Using the Azure Resource Group Deployment task, I was able to use a JSON ARM template to create a new resource group with a web app in it. This way I can specify the resource group, addressing Shortcoming 1
Shortcoming 2: But now I don't understand how I can actually deploy the binaries of the build definition that has been linked against my release definition. The web application that gets created by the resource group deployment is empty, and a subsequent Web App Deployment Task seemingly cannot target this newly created web app, since it is probably not ARM based.
I get the feeling that I am missing something obvious here - any help is appreciated.
Update 1
Thanks to #bmoore-msft, I got a deployment working using the child resource extension example he linked to. Essentially, the corresponding snippet of my ARM template now looks like this:
"resources": [
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[variables('fullEnvName')]",
"location": "[parameters('siteLocation')]",
"properties": {
"name": "[variables('fullEnvName')]"
},
"resources": [
{
"apiVersion": "2014-06-01",
"name": "MSDeploy",
"type": "Extensions",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', variables('fullEnvName'))]"
],
"properties": {
"packageUri": "https://dl.dropboxusercontent.com/u/<myId>/<WebDeploymentPackage>.zip",
"dbType": "None",
"connectionString": "",
"mode": "Complete"
}
}
]
}
]
But the problem is that this places a static link into my template - as you can see, I used Dropbox as temporary solution. But of course I don't want to upload my web deployment package to Dropbox, neither manually nor automatically. I want to link to the artifact created by my build definition, which unfortunately is dynamic and I can't find any information on how to construct this link. For example, build 1 is located at the following path
https://<tenant>.visualstudio.com/DefaultCollection/_apis/resources/Containers/800850?itemPath=<PathToWebDeploymentPackage>.zip
while build 2 is available here
https://<tenant>.visualstudio.com/DefaultCollection/_apis/resources/Containers/801968?itemPath=<PathToWebDeploymentPackage>.zip
So there is a number changing inside the link which means the link I refer to in my template must be dynamic which means I need to understand where to get that number from, which I don't.
Maybe there is another way of referencing artifact uploads?
Take a look at this sample:
https://github.com/Azure/azure-quickstart-templates/blob/75d0588fbd2702288bd35ed24cb00e43dcf980c2/wordpress-mysql-replication/website.json
The website in that template resource has a child resource extension named "MSDeploy". This will deploy a package to the web site during deployment. So in your task that does the deployment you can create the web app, and deploy the package all in the one deployment task in RM.
You will need to use user or SPN authn for anything using ARM (no certs).
Update: Staging the Package
Ok, usually what I do here is "stage" my artifacts in Azure Storage (secured with a sasToken). The uri you provide in the template must be accessible to AzureRM. You VSTS build output is likely secured, so even though you could access it interactively, AzureRM cannot.
Essentially what you need is a task in RM (or build) that will 1) copy the artifacts to Azure (securely) and then 2) tell the next task where those artifacts are... Here's one option:
https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-resource-groups-ci-in-vsts/
This doc is using VSTS build, but RM works the same way. The other part that's different is the doc is using a PS script used by Visual Studio in the Azure Resource Group projects. There's nothing special about that script (it will work anywhere just like any other PS script) but that's the example. It doesn't use the Azure Resource Group Deployment Task because that task cannot do the staging of the artifacts.
Essentially what you need to do is:
parameterize that URI property (see example & repo below)
copy the webdeploy package to Azure (PowerShell in this case)
deploy the template and pass in the uri of the package
e.g.
"packageUri": "[concat(parameters('artifactsLocation'), webdeploy.zip, parameters('sasToken')]"
That doc shows you how VS does it, and you should be able to adapt that for your scenario. If you go this route, you would use the Azure PowerShell task and no longer need the Azure Resource Group Deployment Task.
Another way to do this is with the Azure File Copy task, but currently that task does not output the URI or sasToken, so you couldn't pass it in to the deployment task (there's a PR in the queue to make that work).
Another option if you don't have access to Visual Studio is this repo:
https://github.com/Azure/azure-xplat-arm-tooling/tree/master/PowerShell
It has the same PS script that VS uses, and the templates show an example of the parameterized URL (for a dsc.zip file in this example) but would work the same way for msdeploy.
You've actually hit on one of the more sophisticated scenarios and at the moment not doc'd real well, but it's pretty cool when it works. LMK if you need more help here.

Run acceptance/smoke tests after deployment

I have set up continuous deployment from a Visual Studio Online Git repository to an Azure Web App.
What is the best way to run acceptance/smoke tests on the website after a build is triggered and deployment has completed?
I have already tried POST_DEPLOYMENT_ACTION (How to add a custom post deployment script to azure websites?), but this seems to get ignored.
I also had a look at the Kudu PostDeployment hook (https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks), which appears overly hacky.
I am deploying a standard ASP.NET 4 MVC site by the way. Any help appreciated.
What is hacky about the PostDeployment hook?
An alternative to that could be to subscribe to the PostDeployment hook from the Kudu/SCM site
POST /api/hooks
{
"url": "http://www.callback.com/callback",
"event": "PostDeployment",
"insecure_ssl": false (set to true to ignore https certificate check, for test purposes only)
}
That would give you a POST like below on the specified URL when deployment is done:
{
"id": "cd5bee7181e74ea38a3522e73253f6ebb8ed72fb",
"status": "success", (could be pending, building, deploying, failed, success)
"author_email": "someone#somewhere.com",
"author": "Some One",
"message": "My fix",
"deployer": "Some One",
"start_time": "2013-06-06T01:24:16.5873293Z",
"end_time": "2013-06-06T01:24:17.63342Z"
}
More info here on kudu github wiki
What I ended up doing was customizing the build process to add a RunScriptTask at the end, which invokes my tests.
You can pass build parameters to the RunScriptTask like so:
"-username user#example.org -password test123 -environment " + DeploymentSettings.GetValue(Of String)("ProviderHostedDeploymentEnvironmentName")
If you edit the build definition from Visual Studio -> Team Explorer -> Builds, there is a tab on the left called Process that breaks down the build steps. If you click Show details at the top, there is an option to download the XAML build process template. You can customize this as you wish and then create a new build process template from that file. (Note that XAML build process template file must be pushed to the remote repository beforehand)

Resources