firebase_functions/unauthenticated UNAUTHENTICATED Flutter firebase functions admin [duplicate] - flutter

Recently I added a couple of new callable firebase cloud functions to my mobile app. The thins is, once I deployed and tested my functions I was not able to invoke them failing with an UNAUTHENTICATED error. I re-deployed all my functions and still, the old ones can be invoked while the new one failed with UNAUTHENTICATED. I did some research and people were talking about the version of the Node. I upgraded the Node version but it did not work out. I upgraded the firebase-functions version and the firebase-admin version. No luck.
I tried to browse to the URL of one of the older callable cloud functions that I have deployed before and it was ok. Then I tried to browse to a newly deployed https callable firebase cloud function. I saw this message in my browser:
Your client does not have permission to get URL /function_name from this server.
Any ideas what is going on here?
Thanks

Ok, here is what I found.
According to this page: https://cloud.google.com/functions/docs/securing/managing-access-iam#allowing_unauthenticated_function_invocation
As of January 15, 2020, HTTP functions require authentication by
default. You can specify whether a function allows unauthenticated
invocation at or after deployment.
Here is what you do:
1- Browse to the link above
2- Find "Viewing users" section and click on the "Go to Google Cloud Console" button.
3- On the screen that opens, you will see a list of your deployed cloud functions.
Select the one that is throwing the UNAUTHENTICATED error.
Click the Add Member button that appears on the right pane.
4- Select Cloud Functions Invoker role
5- Type allusers inside the "New Members" box. Select allUsers or allAuthenticatedUsers (Try with both to see which one works for you)
6- Hit "Save"
You should be able to invoke your firebase https callable cloud function now, and the UNAUTHENTICATED error should be gone.

I was having the same problem and what worked for me, was as simple as changing the function's name in the file (and of course where it was called) and redeploying it, which automatically deleted the first one.
EDIT #1: I've just had the same problem again and this time, I didn't rename the function. I only deleted the function manually inside firebase and then I redeployed it. It also works.
EDIT #2: Once again I had the same problem. However, this time I couldn't fix it with the alternatives above. I had upgraded my firebase-tools and something on this new version (10.3.1) was conflicting. Until I figure out what is the problem, I just downgraded firebase-tools (following this: https://stackoverflow.com/a/57262942/14608654) to version 10.2.2 and the error vanished.

in my case, I write wrong function name in my Flutter app
final callable = _functions.httpsCallable('wrong function name in here');

Related

VSTS Extension - Token authentication error

My team and I are working on creating a VSTS extension that will work with VSTS/Azure DevOps in the cloud, but the following 500 error is being thrown when trying to do a REST request:
HostAuthorizationNotFound
Microsoft.VisualStudio.Services.DelegatedAuthorization.SessionTokenCreateException
Here's the code:
// Get an instance of the client
var client = RestClient.getClient();
client.getWorkItem(10343, ["System.Title"]).then(
function(workItem) {
console.log(JSON.stringify(workItem))
},
function () {console.log("test")}
);
Uninstalling and reinstalling the extension has no effect, which seems to be the solution for others who have encountered this problem, and the extension scope was updated to include work items.
Additionally, the personal access token generated for my account works with the VSTS CLI. I'm able to create and query for work items with no issues there.
The Microsoft documentations mentions manual token creation for programs such as C# console apps, but my impression is that this should not be needed when working with an extension.
Is there something token related that needs to be explicitly declared in code?
The solution ended up being the same as what others have posted about: uninstalling and reinstalling the extension. In this case this was something that we tried initially but did not do entirely correctly -- the reinstallation did not take full effect since all the steps weren't followed (an admin also needed to approve the republishing of the extension).
So if you get this error, rest assured that uninstalling and reinstalling should do the trick!
See the following link for more details: https://learn.microsoft.com/en-us/azure/devops/extend/get-started/node?view=vsts#install-your-extension

Azure Function - Publishing Failed - RequestTimeout

I have a basic Azure Function app. When I try to publish the app, I receive an error that says "error : The attempt to publish the ZIP file through https://... failed with HTTP status code RequestTimeout.".
This app is a .NET Standard app. I followed the instructions here. The difference is, my app has an Event Hub Trigger instead of the Http Trigger shown in the documentation. I don't understand why i'm getting a Timeout during deployment. I also don't know how to get past this.
What am I doing wrong?
Update
Here are the logs.
1>------ Build started: Project: MyProject.Functions, Configuration: Release Any CPU ------
1>MyProject.Functions -> C:\MyProject\MyProject.Functions\bin\Release\netcoreapp2.1\bin\MyProject.Functions.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Publish Started
MyProject.Functions -> C:\MyProject\MyProject.Functions\bin\Release\netcoreapp2.1\bin\MyProject.Functions.dll
MyProject.Functions -> C:\MyProject\MyProject.Functions\obj\Release\netcoreapp2.1\PubTmp\Out\
Publishing C:\MyProject\MyProject.Functions\obj\Release\netcoreapp2.1\PubTmp\MyProject.Functions - 20181101105531356.zip to https://my-project.scm.azurewebsites.net/api/zipdeploy...
C:\Users\me\.nuget\packages\microsoft.net.sdk.functions\1.0.23\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.ZipDeploy.targets(42,5): error : The attempt to publish the ZIP file through https://my-project.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code RequestTimeout. [C:\MyProject\MyProject.Functions\MyProject.Functions.csproj]
According to this:
https://github.com/projectkudu/kudu/wiki/Deploying-from-a-zip-file
you should be able to pass ?isAsync=true to the zipdeploy url (so it would be: 'https://my-project.scm.azurewebsites.net/api/zipdeploy?isAsync=true'
This requests resolves faster without a timeout and then you can grab the location header from the response, which you can poll to see the status of your deployment.
In my case this error was because of the version of packages in my .csproj file. After updating them there was not error and the publish was successful.
I faced this recently and spent 2 complete days trying to fix it. Tried most of the solutions suggested here and on other posts.
What finally worked for me is removing my Publish settings and creating a new one by uploading a brand new .PublishSettings file.
How to get .PublishSettings file?
On Azure Portal, on your Function App, click on "Get Publish Profile"
And will automatically start downloading it.
How to Upload Publish Profile?
When trying to Publish the project from Visual Studio, click on New -> Select "Import Profile"
And Browse your .PublishSettings file.
Then, just select this new profile (if it's not selected already), and click on Publish button as you would usually do.
In my case, it was an issue with two things:
1] Visual Studio and Azure are flaky. Timeouts in a working scenario are still somewhat regular, on a bad day happening about 50-75% of the time for me. This is with an 80mb function app, not super big and I have gigabit Internet.
2] Someone deleted the file share for the storage. I had to fix WEBSITE_CONTENTAZUREFILECONNECTIONSTRING to point to the right storage connection string, and I had to update WEBSITE_CONTENTSHARE to point to a valid file share name, which I had to create in the storage resource group matching WEBSITE_CONTENTAZUREFILECONNECTIONSTRING connection string.
If you are using a development and production function slot, I would suggest to make WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE deployment slot settings, that way you can link to a production and development storage environment. This is especially handy if you are using tables or blob storage and don't want to have to prefix or suffix all your table names or keys. In my opinion these two settings should be slots by default.
Once I did these changes I could publish, still dealing with the intermittent timeouts.
The error messaging with Azure function publishing is bad to non-existant, with any kind of configuration or resource errors simply causing a timeout error.
I got the same issue when using Visual Studio. Very frustrating.
But then I just used the zip file that VS created and used
az functionapp deployment source config-zip -g <resource_group> -n \
<app_name> --src <zip_file_path>
to publish.
You can find more options in
https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push
I got the same issue recently.
I'm not sure if they are related, but it started working fine after updating the NuGet package "Microsoft.NET.Sdk.Functions" to v3.0.7.
Changing the profile to use WebDeploy was the only way i could update my Azure Function.
When downloading the Profiles from the Azure Portal, and importing to VS - i noticed it imported 2 profiles. 1 for Zip, and another for Web Deploy method for uploading.
Trying the Zip publish profile, failed, but the WebDeploy 2nd Profile - did work and update perfectly.

VSCODE - Marketplace returned 'ECONNREFUSED'. Please check the 'http.proxy' setting

I am new to Visual Studio. I just installed Visual Studio Code (VSCODE). First time, I opened it and trying to install the extension for powershell. But, when I go to the Extensions tab, it gave an error that the proxy settings were not configured.
The pop up gave an option to 'Open User Settings' and it opened an editor.
As per my understanding, I wrote the following two lines in the User Settings file.
Our internal proxy server requires user authentication. How and where will I put the user credentials. I think, I am getting the error because I have not specified the user details.
Found out how.
The proxy details should be given in the following format. I was using the wrong format earlier.
My settings file looked something similar to below.
// Place your settings in this file to overwrite the default settings
{
"http.proxy": "http://user#domain.local:Password456#10.201.10.200:8080",
"http.proxyStrictSSL": false
}
The domain user name was domain\user, and it was provided in the user FQDN format
Password456 is the login password for the user
10.201.10.200:8080 is the proxy server
Hope this would help someone at some point of time.
I solved this problem like #Tom Jacob Chirayil, but I had to do a little extra. Here are the steps I followed:
Find your proxy server first by going to http://wpad/wpad.dat. My company's configuration had a bunch of proxy servers, and the one that I used was at the very bottom, in this format:
return "PROXY subdomain.company.com:port";
Then click on the Open User Settings button, and add the following line to the settings.json file to the right, within the braces:
"http.proxy": "http://subdomain.company.com:port"
NB: I had to add http:// to the front of the proxy address that I pulled from wpad.dat.
Then save settings.json, restart VS Code. (IDK for sure if you have to restart VS Code or not.)
Just to add a point, it seems that the new release (1.5.1) came with this issue. People on Mac, Linux or Windows suffering with "econnrefused" error in VSCode.
The new version (1.5.2) will have a fix for this, until then, we can use the nightly version.
Source: https://github.com/Microsoft/vscode/issues/11774

Packages not appearing in proget feed

I am using proget to upload packages, I am manually uploading from disk, but when I go to check if the package exists in the feed it isn't there. When I logon to the server which is hosting proget and go to the PackagesRootPath I can see the package is indeed on the server!
Any ideas why it's not showing up in the feed?
p.s. I have restarted the website/application pool and ProGet service and still doesn't work.
If you're not seeing any packages in the web application (and you've verified that they are, in fact, in the right place on disk), this means that the packages aren't getting indexed by the ProGet Service.
Since you've already restarted the ProGet web service, it's likely a problem with the individual package.
Check to see if there are "indexing errors" in the admin section; this will give some insight into what the problem might be. Often times, the file name does not match the package name/version; this is a requirement. If you're package is named MyFoo and is version 3.0.1, it must be MyFoo.3.0.1.nupkg and have an appropriately named MyFoo.nuspec within it.
If there are no errors logged, then you can try to run the service interactively. Simply stop the Windows service, then run the .exe file and select the appropriate option to run.
Another option to verify that the indexing is working OK is to pull a package from a remote connector (like JQuery or something), then drop that package in another feed (that doesn't use a connector).

Click Once Deployment Error

I am new to Click Once Application deployment so I think I may have a simple problem. I have a window app that I created and deployed successfully as a ClickOnce App using Vis. Studio 2010 and deploying to a web service. I made some changes to the app and changed the deployment location so I started the click Once Process over. Now when I deploy I get an error. The app builds fine, runs fine in VS 2010, when I deploy files are created. Double clicking the App.application file will start the install of the app with a .Net framework error.
"Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
System.UriFormatException: Invalid URI: The URI is empty..."
I have double checked and triple checked the Publish Foldre Location and INstallation Folder URL to make sure they are pointing in the correct places and using the correct format. I double and triple checked the Updates dialog box when you click the Updates button. The combobox for the Application Updates matches the Installation Folder URL. "\MyServer\Users\Administrator\Desktop\Transfer\Deploy\" I double checked to make sure the required files are correct. Security settings did not change.
What could I be missing?
It seems you missed one backslash in your installation folder URL:
\\MyServer\Users\Administrator\Desktop\Transfer\Deploy\
Please make sure that if you are using some image/sound or log files then its Build Action must be "Content" type.