I have followed the Tutorial and build the basic CF based nodejs applciation to display all BusinessPartners from my S/4HANA on-premise destination.
function getAllBusinessPartners(): Promise<BusinessPartner[]> {
return BusinessPartner.requestBuilder()
.getAll()
.execute({
destinationName: 'MockServer'
});
}
Destination is configured with the Virtual host from cloud connector.
But after deploying to the Cloud Foundry, i get following error for the GET request
{"message":"Service of type destination is not supported! Consider providing your own transformation function when calling destinationForServiceBinding, like this:\n destinationServiceForBinding(yourServiceName, { serviceBindingToDestination: yourTransformationFunction });","level":"warn","custom_fields":{"package":"core","messageContext":"destination-accessor"},"logger":"sap-cloud-sdk-logger","timestamp":"2020-03-09T18:15:41.856Z","msg":"Service of type destination is not supported! Consider providing your own transformation function when calling destinationForServiceBinding, like this:\n destinationServiceForBinding(yourServiceName, { serviceBindingToDestination: yourTransformationFunction });","written_ts":1583777741856,"written_at":"2020-03-09T18:15:41.856Z"}
The application is already bound to the Destination service as well.
Can someone help me here, what went wrong ? or the approach to use destination is different in the new version of Cloud-SDK ?
After lot of attempts, i have made this to work.
My Observations:
Connectivity service is also required to be bound, when using on-premise S4 backend.
There was no errors in the log, i have made certain modification in the code to use async/await
async function getAllBusinessPartners(): Promise<BusinessPartner[]> {
return await BusinessPartner.requestBuilder()
.getAll()
.execute({
destinationName: 'MockServer'
});
}
After this modification, when I hit the GET request, it gave me the following error:
"Failed to get business partners - get request to http://s4h-scc-basic:500/sap/opu/odata/sap/API_BUSINESS_PARTNER/sap/opu/odata/sap/API_BUSINESS_PARTNER failed!"
Could notice that the suffix after the http://domain:port is twice. One I gave in the destination, and the other VDM adds automatically.
Ideally, this error is supposed to be thrown even before adding async/await.
After removing the suffix from the destination, it started to work.
If your request really does error, what you posted here from your logs is most likely not the reason for the failure. We are aware that this message is confusing and will improve it (https://github.com/SAP/cloud-sdk/pull/32).
Can you check whether there are more errors in your logs? Based on the code you posted and the setup you described, this should work. Do you have a binding to the XSUAA service.
Related
i am new in firebase, i have deploy one function, and it is using get method,
https://us-central******.cloudfunctions.net/addMessage
when i try to run this api, i am getting below error
Error: Forbidden
Your client does not have permission to get URL /addMessage from this server.
Can anyone please help me to resolve this issue ?
exports.addMessage = functions.https.onRequest(async (req, res) => {
// Grab the text parameter.
const original = req.query.text;
// Push the new message into the Realtime Database using the Firebase Admin SDK.
const snapshot = await admin.database().ref('/messages').push({ original: original });
// Redirect with 303 SEE OTHER to the URL of the pushed object in the Firebase console.
res.redirect(303, snapshot.ref.toString());
});
From the doc, argument --allow-unauthenticated:
Specifies that the function does not require authentication to invoke. By default HTTP functions require authentication. If you do not include this flag the first time you deploy an HTTP function, you are prompted to allow unauthenticated invocations. You are not prompted on subsequent invocations.
So, you need to deploy the cloud functions with this argument if you don't need authentication. E.g.
A simple cloud function, index.js:
exports.helloHttp = (req, res) => {
res.send(`Hello ${req.body.name || 'World'}!`);
};
Deploy without --allow-unauthenticated:
gcloud beta functions deploy helloHttp --trigger-http --runtime nodejs10
When you access the endpoint of this cloud function: https://us-central1-xxxx-218801.cloudfunctions.net/helloHttp. You will get this 403 Forbidden error:
Error: Forbidden
Your client does not have permission to get URL /helloHttp from this server.
Deploy with --allow-unauthenticated:
gcloud beta functions deploy helloHttp --trigger-http --runtime nodejs10 --allow-unauthenticated
You will get access the endpoint without authentication.
Hello World!
I ran into this (or a very similar problem) today. When I invoked one of my functions from Postman, I got:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>401 Unauthorized</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Unauthorized</h1>
<h2>Your client does not have permission to the requested URL
<code>/myApi/somePath?</code>.</h2>
<h2></h2>
</body>
</html>
I try redeploying the functions but that didn't work.
Solution: Delete your functions and deploy them again.
What I did was:
Exported a single dummy function from functions/index.ts and removed my original functions.
Deployed. That deleted my original functions.
Verified that the dummy function worked well.
Restored my original functions and deployed again.
Verified that my original functions worked.
Background and possible cause
I had a new Firebase project and I tried to deploy my functions many times but got some errors related to permissions. I guess that left the functions in a weird state...
I managed to deploy the functions successfully later, but they were not in a good state and I got that error response from Postman when I called one of them.
The errors I got were the following:
Error 1:
Error: Missing permissions required for functions deploy. You must have permission iam.serviceAccounts.ActAs on service account some-sa#appspot.gserviceaccount.com.
Error 2:
Error: Missing permissions required for functions deploy. You must have permission iam.serviceAccounts.ActAs on service account some-sa#appspot.gserviceaccount.com.
Error 3:
Unable to set the invoker for the IAM policy on the following functions:
someFunction1(us-central1)
someFunction2(us-central1)
Some common causes of this:
- You may not have the roles/functions.admin IAM role. Note that roles/functions.developer does not allow you to change IAM policies.
After trying to delete individualy functions and uploading them again ultimately i had to delete all of the previously deployed functions and deploy them all.
Once i'd done that a couple of times, the functions deployed.
There are two possible causes i can think of that was causing this, both very ambiguous.
I found that there was one offending file, and the only thing that fixed the deploy was to change the length of the file name. Yes, the length of the filename. One character too long and the deployment failed. If this was a windows 95 machine i'd have said the inheritance chain path was too long for the compiler. However, compiliation and running on the emulator worked fine. So who knows.
I had tried to set up cloud build, and left that part half finished. I had updated the .firebaserc as a part of that. Perhaps, just perhaps, the deployment didn't like the fact the default projects list had changed, and didn't match the existing functions.
I'm totally guessing as to the cause, but because the error is so ambiguous, with no apparent cause, figued this might help people find the cause.
It can also happen, if you use the wrong subpath. For me the url was somehow wrong, instead of resendConfirmEmail it tried to call resendConfirmEmail%20. That function didn't exist and google responded with 403:
https://europe-west1-my-project.cloudfunctions.net/resendConfirmEmail%20?userId=imFeBoV...&email=gr...%40...com
when it should have been:
https://europe-west1-my-project.cloudfunctions.net/resendConfirmEmail?userId=imFeBoV...&email=gr...%40...com
Using ArangoDB documentation version 3.3 or version 3.4 for the Getting Started section of Foxx Microservices, I can't get past this error:
Failed to load API definition.
NetworkError when attempting to fetch resource. http://192.168.1.1:8529/_db/_system/_admin/aardvark/foxxes/docs/swagger.json?mount=/getting-started
That error is shown on the API tab of the service. After installing my service according to the tutorial, I get the service's card as described. I click that card and then click the API tab and the above error is shown.
To eliminate typos, I have tried copying and pasting the exact file contents from the ArangoDB documentation and following every step exactly, and I still get the same error.
The Info tab of my newly created getting-started service contains this info:
Author:
Mount: /getting-started
Mode: Development
Version: Unknown
Version License: Unknown License
Path: /var/lib/arangodb3-apps/_db/_system/getting-started/APP
The example contains only two files and they are:
manifest.json
{
"engines": {
"arangodb": "^3.0.0"
},
"main": "index.js"
}
index.js
'use strict';
const createRouter = require('#arangodb/foxx/router');
const router = createRouter();
module.context.use(router);
router.get('/hello-world', function (req, res) {
res.send('Hello World!');
})
.response(['text/plain'], 'A generic greeting.')
.summary('Generic greeting')
.description('Prints a generic greeting.');
The canned demo services, such as the hello-fox example, work correctly. I collected more error information:
Navigating to http://192.168.1.1:8529/getting-started
404: errorMessage "unknown path '/getting-started'"
Navigating to http://192.168.1.1:8529/_db/_system/getting-started
404: errorMessage "unknown path '/getting-started'"
The console also shows:
WARNING File not found "/getting-started": file "" does not exist in "/var/lib/arangodb3-apps/_db/_system/getting-started/APP/files".
The tutorial doesn't indicate another file named getting-started or another location for the two specified files. What am I missing?
This issue was resolved based on the helpful comments by #camba1. There was no problem with Arango, just a problem with me understanding the tutorial. For others in my position, here are the things I did not understand properly and that, when addressed, resolved my problems.
The API tab, in contrast to what the tutorial says, will give the error "Failed to load API definition" even for a correctly working service. Ignore that error message. I am not yet using the API tab at all.
the tutorial refers to two paths, '/hello-world' and '/getting-started'. These are used on the endpoint (URI) and in creating the router like below:
router.get('/hello-world', function (req, res) { ...
The tutorial wasn't as clear as it could have been on this point, but as #camba1 pointed out, the service endpoint would end up incorporating both of those elements:
192.168.1.1:8529/_db/_system/getting-started/hello-world .
this very basic demo is easier and better in my opinion when the router is created without a path:
router.get(function (req, res) {
In this case it defaults to a path of '/'. I think this may avoid confusion for raw beginners like me. The service endpoint then becomes one element simpler. In my case, the endpoint (with Arango running on another computer on the LAN) becomes:
192.168.1.1:8529/_db/_system/getting-started
The tutorial would be improved if it either added a couple extra sentences to explain how the endpoint is constructed, or alternatively, did as I suggested above and simplified things by one step.
I can publish a Azure function from Visual Studio without an error.
This funtion is set to run every 4 seconds ("*/4 * * * * *") but it is not running at all. Even if I try to run it manually it do not run and show the following error:
Status: 404 Not FoundThe resource you are looking for has been
removed, had its name changed, or is temporarily unavailable.
Under monitoring it do not shows data, under success or error count it says no data available :(
Nothing is working please help
This is a pretty old thread but in case anyone is facing the same issue after migrating their Function App to .NET Core 3.1, check that you have also updated the Function Runtime Version to 3. Update the Function App SDK and in Azure portal check that the function runtime settings is 3. Without updating this setting the same 404 error appears whenever you try to call your function app.
For changing the Function Runtime Version open the Function App in Azure Portal then go to Configuration -> Function runtime settings. From the Runtime version dropdown choose ~3.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
According to your 404 error message, it means your function source couldn’t be found. Such as wrong resource path , function name has been changed, wrong function name or the function has been deleted.You could check whether your class name and FunctionName attribute name are consistant. If you have changed code, remeber to rebuild the project.
And please make sure you could run the Azure function successfully in Visual studio before published to Azure. In debug mode, check whether output logs are correct.
Under monitoring it do not shows data, under success or error count it says no data available
This info usually means function has never been triggered before. If you create a new function in Azure and click Monitor directly, you could also see this info. To solve this problem, unless you could trigger this Azure function successfully.
In my case I was deploying the azure function using the Azure Resource Manager (ARM) template. I created it manually and was missing some of the properties for the storage account:
For anyone deploying an Azure Function using an ARM template, I would highly recommend taking a template from the GitHub quickstart ARM templates: https://github.com/Azure/azure-quickstart-templates
It provides the minimum template to get your function (and other resource) up and running.
The issue with your function was that GetFTPData.cs is not a valid function name. VS build doesn't validate the function name and the portal isn't displaying these errors.
This issue is tracking the portal error display https://github.com/Azure/azure-functions-ux/issues/2316
and this is for VS build to validate functionName attribute https://github.com/Azure/azure-functions-vs-build-sdk/issues/174
I have an application, that's written in Go that uses this function and it keeps failing to resolve a DNS name. I can resolve the DNS name on the server just fine using other applications but not the Go-based one that uses this function.
When in doubt, "Use the source, Luke". Reading dnsclient_unix.go reveals that it iterates over all configured servers.
But mind the note:
// If answer errored for rcodes dnsRcodeSuccess or dnsRcodeNameError,
// it means the response in msg was not useful and trying another
// server probably won't help. Return now in those cases.
// TODO: indicate this in a more obvious way, such as a field on DNSError?
It would seem that streaming breaks when there is too many devices in the account. After about 8 or 9 it just stops streaming data to me all together.
Are you using Firebase? I came on here to post a similar issue myself. If I change the temp through the nest device or the web tool, my Firebase listeners are updated. If I try to set a value, the value that I try to set is echoed back to my listener (like there has been an update on the thermostat even though it wasn't changed successfully) then, the correct value (unchanged) comes immediately after.
The weird thing is that it works.... then it just doesn't. Is this similar to what you've been experiencing?
Update:
Now it appears as if my listeners are not working either. I can query the server using REST successfully.
Update #2:
Now my listeners are working again but still no control.
Update#3:
Well... I think I see my problem at least. I don't know if it will help you (or me for that matter) but here it is...
protected void setHighTemp(int value){
fb.child("target_temperature_high_f").setValue(value, new CompletionListener() {
public void onComplete(FirebaseError arg0, Firebase arg1) {
System.out.println("Communicaiton error: " + arg0);
}
});
Output:
Communicaiton error: FirebaseError: Too many requests
I remember reading the following paragraph in https://developer.nest.com/documentation/glossary#client
Client
An integration of your application or service with Nest
devices. When you create a Nest account and sign up for the Developer
Program, you can add up to 10 clients to the account.
This might be your problem.