Error (EvaluationException) on executing setSelectionFormula in XPage - Javascript code - javascript

When using XPages in Lotus Domino Designer, I encounter the following error (displayed in log file) on trying to set the view formula dynamically.
com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript computed expression
The following code fails ...
var helpview:NotesView = db.getView(viewNm);
var strQS:string= sessionScope.searchKey;
helpview.setSelectionFormula(strQS);
Error takes place at the setSelectionFormula line. strQS is the string for view selection formula.

This message just means there's an error in your code. Error handling will identify more details of why. Something like XPages OpenLog Logger (which is also incorporated into OpenNTF Domino API, if you also want that) will identify the cause. XPages OpenLog Logger captures the cause regardless of whether or not there is specific error handling on that block, providing a custom error page is added to the application.
The most probable cause, though, is that the user the database is being retrieved under does not have at least Designer access to the database, either in the ACL or Maximum Internet Access on the Advanced tab of the ACL.

Related

ApplicationInsightsTelemetryClient not logging bot identifiers

I'm using the JavaScript version of the botframework. I've followed the documentation to enable telemetry logging in Application Insights. When I access the logs I can see that custom events are being logged.
The issue is that the bot specific identifiers, such as user_Id, session_Id and conversation_Id are not being logged. This can be seen in the screen capture below
In the applicationInsightsTelemetryClient.js file there is a function called addBotIdentifiers. As far as I can tell, it is this function that is responsible for adding the bot specific identifiers.
The first lines of the function look like this:
function addBotIdentifiers(envelope, context) {
if (context.correlationContext && context.correlationContext.activity) {
Inspecting this function shows that the context argument is always null.
This leads me to my questions.
Why is it null?
Any suggestions on what I need to do to have it set appropriately?
Update
In digging into this further it appears the code starting at line 26 in the applicationInsightsTelemetryClient.js file isn't being called. Could this be the cause of the missing context later on in the addBotIdentifiers function?
Looks like the documentation has a missing line in step 7. We will correct the document ASAP. Meanwhile, please add the below in your index.js following https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/javascript_nodejs/21.corebot-app-insights/index.js#L113
// Enable the Application Insights middleware, which helps correlate all activity
// based on the incoming request.
server.use(restify.plugins.bodyParser());
Further investigation has shown what the issue was. It's not immediately obvious.
I compared the code in my index.js file with the one in the 21.corebot-app-insights BotBuilder sample.
Note that the setup of the Restify server happens after the creation of the adapter bot adapter. It is also after the configuration of the main dialog and the middleware.
In my code the setup of the Restify server and the bot adatper / dialogs was intermingled. This appears to have been the cause of the problem.
The main lesson here for me, and for anyone who stumbles across this post later, is that the setup of the Restify server should be at the end of the index.js file. To ensure all of the bot framework is setup first.

Stripe.js was not loaded correctly

I'm loading stripe into my payment page like so:
<script src="https://js.stripe.com/v3/"></script>
This works perfectly in my local test environment but in production, the following console error appears:
Uncaught Error: It looks like Stripe.js was not loaded correctly
at new e (controller-84824401a25a5595fc578f767b4d5c27.js:1)
at controller-84824401a25a5595fc578f767b4d5c27.js:1
at Object.bnjt (controller-84824401a25a5595fc578f767b4d5c27.js:1)
at t (shared-d3604a85e14ef273096e09821a0e4c2a.js:1)
at Object.3 (controller-84824401a25a5595fc578f767b4d5c27.js:1)
at t (shared-d3604a85e14ef273096e09821a0e4c2a.js:1)
at window.webpackJsonp (shared-d3604a85e14ef273096e09821a0e4c2a.js:1)
at controller-84824401a25a5595fc578f767b4d5c27.js:1
I can't work out what might be causing the error. I'm using HTTPS in production and can see the JS file source downloading successfully. Any tips?
Solved following advice from #NathanCasebolt. SO mods deleted his original answer:
“For me, the resolution to this error was as simple as spell-checking
my variables. In my backend server code, one of my variables was
wrongly capitalized. Since the misspelled variable was part of the
function that retrieves my publishable key, the key returned from the
server as null. This, in turn, disrupted creation of the Stripe object
and threw this error. If I were you, I'd check to make sure (1) that
the publishable key on your frontend matches the publishable key in
your dashboard, and (2) that you're not doing anything that might
disrupt serving this key to Stripe.”
The StackOverflow mods felt this didn’t answer the question and
required too much clarification. So, to clarify, the problem for me
was this line:
var stripe = Stripe(‘{PUBLISHABLE_KEY}’);
I set things up to retrieve my publishable keys from my server, to
give me more flexibility in switching between test keys and live keys.
Since my one of my server variables was wrong, I was providing Stripe
with a bad key (no key, really), and that’s what threw the error. This
is why I suggest you check the publishable key you’re using to create
the Stripe object, to make sure that the one you’re using to create
the object is there, and that it matches the publishable key you have
on your Stripe dashboard."
In my case, this is exactly what I'd done wrong: provided an empty publishable key when initialising Stripe. Ultimately a very simple mistake compounded Stripe's obtuse error message.

How to parse error with Square Connect API example (Node)

I am trying to learn how to process payments with Square, and am trying to run their examples from GitHub to get a feel regarding how to structure the payments application. I built the node example from here: https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/node_payment using npm install and npm build to get the app up and running.
I am using "4532759734545858" for the card number, "123" for CVV, "0120" for expiration, and "94103" for the zip. I got the card number from here: https://docs.connect.squareup.com/articles/using-sandbox where it states that this is a good number to use for a Visa sandbox.
Also, I have updated the config.json with properties from my developer settings.
When trying to process a payment a get a DOM element that says "Card Declined" without further specifying the error. Is there something I can do to parse the error?
Based on the documentation at: https://docs.connect.squareup.com/articles/using-sandbox#generatingerrorstates it seems the amount_money field of the request is not being populated, but I am having trouble confirming.
Ideally I would like to get to a point where I can add a card as a hash value to my db and use it for recurring billing...
That "card declined" message is actually the error you get back from Square's APIs. You can play around with the error messaging in the app.js file and the `error.jade. Try error.catagory, code, detail.
Keep in mind that this is just a sample app, to show that you can use the APIs with node.js, you probably don't want to use this code in your production system.

Web application breaks when user added to role

Using Identity 2.0 with a Web Forms project.
I can login successfully, and control access to pages using <allow users="<emailaddress>"/>, but when I add a user to a role in AspNetUserRoles, it causes the application to return this error:
The specified cast from a materialized 'system.int32' type to the 'system.string' type is not valid
The string of code that Visual Studio references on the crash is:
var user = manager.FindByName(Email.Text)
How can I fix this?
Discovered the problem. Our DB editor had changed the AspNetRoles table so that the RoleID field would auto-increment, and in doing so, the field changed from an NVARCHAR(256) to an INT. Changed it back and the problems has been resolved.

Log In with PayPal button JavaScript code builder validation error

Sorry for the basic questions but as a very first step I'm just trying to test the "Log In with PayPal button JavaScript code builder".
I've created an app, gone to this button builder, set the return URL to my localhost and then as that failed to a public website (http://bbc.com) making the same settings on my app details page but whatever I do when clicking the button I get the following error:
"Relying Party Validation error: redirect_uri provided in the request does not match with the registered redirect_uri. Please check the request."
I've tried setting the button up for sandbox and production but both fail.
Has anyone had the same issue? I'm guessing I'm doing something really stupid. I'm just taking the "Dynamically generated JavaScript" code and adding it to an empty webpage.
Thanks.
Turns out it takes a while (a few hours) for the PayPal API to update to changes in the admin console. Changes were reflected after several hours, very unhelpful for testing. That was using the production option. Even when return_uri was being recognised as correct the scope settings were invalid despite selecting all the correct options.

Categories

Resources