I'm following tutorial on http://martinabbott.azurewebsites.net/2016/06/11/fun-with-azure-functions-and-the-emotion-api/
Finally got solvet issue with blob trigger. I have verified that my jpg file can be succesfully processed with my API key in the Open API Test console. I have upload project.json file include dependancies to "Microsoft.ProjectOxford.Emotion": "1.0.251"
I'm getting now error. How to solve?
2016-11-07T06:53:44.951 C# Blob Emotion function processed: Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob
2016-11-07T06:53:45.076 Function completed (Failure, Id=c0c50024-7830-4595-b749-56f58ec79d0b)
2016-11-07T06:53:45.107 Exception while executing function: Functions.BlobTriggerEmotionFunction. Microsoft.ProjectOxford.Common: Exception of type 'Microsoft.ProjectOxford.Common.ClientException' was thrown.
Based on the tutorial you are referencing, for the line of code,
var apiKey = WebConfigurationManager.AppSettings["EMOTION_API_KEY"];
did you set the EMOTION_API_KEY in your Function app's App settings?
You may verify with the following steps:
Visit your Function app through the Functions portal.
Click Function app settings -> Configure app settings.
Verify that the EMOTION_API_KEY exists and that its value matches the one you used in the Open API Test console.
Related
I'm trying to follow this guide to put some custom logging into a firebase function. The function itself is running, and I can see the data being passed in (it's an https 'callable' function). But as soon as it hits the line where it tries to actually write that log entry, I get "Error: 7 PERMISSION_DENIED"
Since the console.log() calls write to the cloud logs, I'd assumed the firebase function has access to Cloud Logging. But perhaps it needs additional permission? I can't find any reference to where this should be set on that page though.
// Logging, logName, region, functions are provided by the surrounding app
const logging = new Logging()
const log = logging.log(logName)
const METADATA = {
resource: {
type: 'cloud_function',
labels: {
function_name: 'CustomLog',
region
}
}
};
exports = module.exports = functions.https.onCall(async data => {
const exVersion = 6
const exId = data.exId
console.log('***** exVersion:', exVersion, 'exId:', exId) // exId from caller
const entry = log.entry(METADATA, data.error) // data.error from caller
console.log('METADATA:', METADATA) // Shows in Logs Explorer
console.log('entry:', entry) // Shows in Logs Explorer
log.write(entry) // Results in Error: 7 PERMISSION_DENIED
return {
exVersion,
exId,
}
})
If I run it from the CLI using firebase function:shell, the log entry is created correctly, so I'm pretty confident the code is correct.
OK, I finally tracked it down. According to this answer, the service account used by firebase functions is {project-id}#appspot.gserviceaccount.com, and in my project, that account did not have the 'Logs Writer' role. Adding that role solves the problem.
I find it odd that the firebase functions don't need that role to log messages using console.log(), but perhaps that call is intercepted by the functions environment, and the logs are written as a different service account. It also explains why the functions running locally were able to write the logs, as they run using the 'owner' service account, which has full access.
According to the Firebase documentation page you have linked:
The recommended solution for logging from a function is to use the
logger SDK. You can instead use standard JavaScript logging calls such
as console.log and console.error, but you first need to require a
special module to patch the standard methods to work correctly:
require("firebase-functions/lib/logger/compat");
Once you have required the logger compatibility module, you can use console.log() methods as normal in your code.
Thus you might to require this library, however I am not sure this is producing your "Error: 7 PERMISSION_DENIED error, but you might also try some solutions that have worked for some members of the community.
Perhaps the logging API is not enabled in your project. You'll get a permission denied error when attempting to use it in that case.
It's a couple levels in, but the guide you linked points to
https://github.com/googleapis/nodejs-logging#before-you-begin, which includes a step to "Enable the Cloud Logging API"
1) Now I am facing issue with firebase. After one month, I am trying to deploy new code using command “firebase deploy –only function” in command prompt. I got below error
Error: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth
For CI servers and headless environments, generate a new token with firebase login:ci
Then I have executed “firebase login –reauth” , I got below comments
“? Allow Firebase to collect anonymous CLI usage and error reporting information? Yes
Visit this URL on any device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplat
formprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=430670875&redirect_uri=http%3A%2F%2Floca
lhost%3A9005
Waiting for authentication...”
It opened in new browser. In their , i have selected my google account and pressed “allow” button. I am getting firebase login failure error in browser.
“Oops!
Firebase CLI Login Failed
The Firebase CLI login request was rejected or an error occurred. Please run firebase login again or contact support if you continue to have difficulty logging in
“
After this I have executed command “ firebase login” in command prompt, I got response as “Already logged in as thirus.selvam.2007#gmail.com”. Once again I have tried “firebase deploy –only functions” , I got same error.
I didn’t get any errors on last month, How to resolve this error?
2) After these error, i have planned to create another test project using Google cloud please find the response in the response in command prompt
C:\app\Google Home\test\TestingSetup>gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [testsetup] are:
core:
disable_usage_reporting: 'True'
Pick configuration to use:
[1] Re-initialize this configuration [testsetup] with new settings
[2] Create a new configuration
[24] Switch to and re-initialize existing configuration: [samplets6]
[25] Switch to and re-initialize existing configuration: [three-door-3456]
Please enter your numeric choice: 2
Enter configuration name. Names start with a lower case letter and
contain only lower case letters a-z, digits 0-9, and hyphens '-': testingsetup
Your current configuration has been set to: [testingsetup]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...\
In response to the following Firebase Objective-C/Xcode code:
Firebase *myRootRef = [[Firebase alloc] initWithUrl:#"https://home.FirebaseTest.firebaseio.com"];
note: home.FirebaseTest is my Firebase app name (see link below)
https://www.firebase.com/docs/ios/quickstart.html
I receive the following exception/error:
Terminating app due to uncaught exception 'No Firebase namespace
specified.', reason: 'No Firebase namespace found for input: '
How can I resolve this problem?
I'm pretty sure that your problem relies on your URL.
Didn't get how you named your project home.FirebaseTest and what this home. stands for.
But you can get the proper url going to firebase console and on "Database" tab you should be able to see your firebaseio.com url.
For example in an app called "myfirebasetest" it would be
https://myfirebasetest.firebaseio.com
On legacy UI it is the url you use to access the console.
I've setup Google login in my Firebase app (I'm using the new Firebase console), but each time I try with Google, I get the following error:
#<NSError:0x11f0625a0, description="An internal error has occurred, print and inspect the error details for more information.", code=17999, domain="FIRAuthErrorDomain", userInfo={"NSUnderlyingError"=>#<NSError:0x122278130, description="The operation couldn’t be completed. (FIRAuthInternalErrorDomain error 3.)", code=3, domain="FIRAuthInternalErrorDomain", userInfo={"FIRAuthErrorUserInfoDeserializedResponseKey"=>{"message"=>"", "errors"=>[{"reason"=>"invalid", "message"=>"", "domain"=>"global"}], "code"=>400}}>, "error_name"=>"ERROR_INTERNAL_ERROR", "NSLocalizedDescription"=>"An internal error has occurred, print and inspect the error details for more information."}>
I don't really know where yo go from here, since there's no message in the message field. Any guesses on what this could be?
I've recently migrated to the new version of Firebase btw. I'm using the new SDK in my iOS app. Furthermore, I setup Google authentication a week before I migrated. I'm not sure if any keys have been overwritten in the migration. How do I check if I have the right keys in my console vs my GoogleService plist file?
I am trying to run the Csharp sampleAppAdvanced from this code https://github.com/evernote/evernote-cloud-sdk-windows
I substituted the consumer key and secret with those that I got in the email when I requested the API key.
ENSessionAdvanced.SetSharedSessionConsumerKey("xyz","123","sandbox.evernote.com");
if (ENSession.SharedSession.IsAuthenticated == false)
{
ENSession.SharedSession.AuthenticateToEvernote();
}
But I always end up hitting an error at this point
ENNoteRef myRef = ENSession.SharedSession.UploadNote(myNoteAdv, null);
With exception reading "Exception of type 'EvernoteSDK.ENAuthExpiredException' was thrown."
On the console the error reads "EvernoteSDK: ENSession is unauthenticating."
Am I missing something? I know the Application is authorized for access.
The other sample code called sampleApp, doesn't throw an error but doesn't display notes either.
When you register the api, did you choose Basic Access or Full Access?