Why do I get error when trying to add file attachments? - outlook

I am trying to use the method addFileAttachmentAsync() in office.js library.
This is the signature of the method I am using:
item.addFileAttachmentAsync(uploadLink, fileJson.name, { asyncContext: null }, function (asyncResult) { });
uploadLink is a string and here is an example of a file I'm trying to upload: https://xdr.purequad.com:6443/files/1b783908-a259-4839-93e2-18fe3248b943_moto.pdf.xdr
The file above is about ~3MB, but when I use a file under 1MB everything works perfectly.
Afterwards it throws this Exception :
Line: 9
Error: Unable to get property 'isInstanceOfType' of undefined or null reference
Also I have to mention this behavior happens only in IE11, while Google Chrome does not throw any exception at all and still does not work.
EDIT: The function was being interrupted before it ended properly! Check my comment.

I have solved the issue myself. When using addFileAttachmentAsync() because it's an async call one should never interrupt the task-pane with Office.context.ui.closeContainer() which was my case. Otherwise it will generate unexpected behavior.

Related

How can I get Google Auth working with Laravel?

I'd like to know if there's an easy fix for this error that I'm getting while trying to add support for Google sign-in to my website, since I can only reproduce it while on a Laravel-based environment. Vanilla PHP applications do run just fine.
This is my relevant code:
if ($request->has('googleToken')) {
$client = new Google_Client(['client_id' => env('GOOGLE_PLATFORM_CLIENT_ID') ]);
$payload = $client->verifyIdToken($credentials['googleToken']);
if (!$payload) {
return response([ 'error' => 'Invalid token, please try using form-based authentication.' ], Response::HTTP_FAILED_DEPENDENCY);
}
$user['googleToken'] = $credentials['googleToken'];
}
I know I'm doing too relaxed validations, but please just focus on the fact that I'm just testing and I plan to change this code in the near future.
The code above, receives its data through an Axios PUT request from the frontend with the payload looking like this:
{
googleToken: "eyJhbGciOiJSUzI1NiIsImtpZCI6IjE5ZmUyYTdiNjc5NTIzOTYwNmNhMGE3NTA3OTRhN2JkOWZkOTU5NjEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXpwIjoiNTkyODkzNjE3ODYzLXRscDdvaDByaTk2dTZxZGxrOXYwbHAyanQyNDlkdDNsLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiYXVkIjoiNTkyODkzNjE3ODYzLXRscDdvaDByaTk2dTZxZGxrOXYwbHAyanQyNDlkdDNsLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwic3ViIjoiMTE1NTg0MDg0NTE2OTMxOTQzODU..."
mailAddress: "user#mail.com"
}
The problem is that the payload would simply return false. I decided to try to investigate the issue, so I went to the definition of verifyIdToken contained within Google_Client and, from there, jumped over to the function that finally returns to its parent, which is verifyIdToken from the class Verify.
Inside of that class, there's a pretty loose try/catch block in which I decided to try adding a generic exception case so that I could quickly print the error message for debugging. I did, and this is the output I got:
OpenSSL unable to verify data: error:0909006C:PEM routines:get_name:no start line
This is what's failing internally, and from this point on, I don't really have an idea about how to proceed since the error feels very cryptic, or at least it's not in my field of knowledge.
The OpenSSL error you quoted indicates that your client was not able to read any/further PEM-encoded data. Refer to https://www.openssl.org/docs/man1.1.1/man3/PEM_read.html.
OpenSSL unable to verify data: error:0909006C:PEM routines:get_name:no start line
Here,
'PEM routines' represents the library within OpenSSL
'get_name' is the function
'no start line' is the reason
Is you client able to access the necessary certificates/keys?

NS MediaFilePicker - Class constructor Observable cannot be invoked without 'new' and 'on' property does not exist on type

Using MediaFilePicker exactly as documented after fresh install I get JS Console Error:
Class constructor Observable cannot be invoked without 'new'
Tried to follow the instructions on this pagehttps://market.nativescript.org/plugins/nativescript-mediafilepicker/
But I get two errors:
first error:
The call is a simple button referring to onSelectImageTap
onSelectImageTap() {
let mediafilepicker = new Mediafilepicker();
mediafilepicker.openImagePicker(this.options);
mediafilepicker.on("getFiles", function (res) {
let results = res.object.get('results');
console.dir(results);
});
}
At line 1 of that call I get Class constructor Observable cannot be invoked without 'new' error?
Later, the .on() call in VS Code gives me an error indication saying that 'on' is not a function.
As far as I can see I do everything as per the instructions?
Any hints?
I had the same issue, this is how I resolved the issue:
I was using version ^3.x.x of MediaFilePicker with NS 8.x.x
Changing to version ^4.x.x on MediaFilePicker in package.json and doing npm install resolved the issue for me. PS: Replace the "x" with actual digits e.g. 4.0.2

How to fix "Cannot read property 'apply' of undefined" trying to get the location using Protractor?

I'm trying to get an element's location using the Protractor (v6.0.0) method call getLocation(), however I'm getting the following exception:
TypeError: Cannot read property 'apply' of undefined
at <Jasmine>
at actionFn (/usr/lib/node_modules/protractor/built/element.js:95:44)
at <Jasmine>
at actionResults.getWebElements.then(/usr/lib/node_modules/protractor/built/element.js:468:44)
at <Jasmine>
at ElementArrayFinder.applyAction_(/usr/lib/node_modules/protractor/built/element.js:466:29)
Any clue how to resolve the issue?
Actually my code is really simple.
it('should compare login page with a baseline', async () => {
let input = element(by.id('mat-input-1'));
await input.getLocation();
});
I expect the coordinates of the input which has id mat-input-1, but unfortunately I'm getting that exception.
Protractor's CHANGELOG.md has a link to the selenium-webdriver CHANGELOG, it lists:
Changes for W3C WebDriver Spec Compliance
Replaced WebElement.getSize() and WebElement.getLocation() with a
single method, WebElement.getRect().
So it looks like you should use .getRect().
Now for Protractor 6 itself, this is clearly an issue with documentation. We recommend using 5.4.2 for now.

What's the correct syntax for calling query.getObjectwithId(<id>, error())?

Environment:
Parse SDK version 1.90
Swift 2.1
Scenario:
Attempting to catch a query throw of an bad-query exception. I got the query template but I don't know the 2nd (error) parameter format.
I can't figure out what the syntax for the error parameter should be:
I removed the 'if' per suggestion, but got another compiler error:
Remedy?
The syntax of the error parameter is correct. However objectWithId does not return an Optional so wrapping it in a if let is not necessary and will cause an error (the 2nd error in your case).
This compiles without errors:
do {
let object = try query.getObjectWithId("OBJECT_ID", error: ())
print(object)
} catch {
print(error)
}
Regarding the Editor placeholder in source file error: That's strange one. Did you copy that code somewhere and paste it into Xcode? Try re-writing the code by hand. I did not get that error and I'm sure that it is unrelated to the syntax of the error parameter.
Apparently I was using an older parse.com SDK (v1.8.2). So I've updated to v. 1.9.0.
I got assorted Swift 2.1 syntax errors after I updated the parse.com frameworks.
So the remedy is the revised APIs using the new Swift 2.1 error handling paradigm:
do {
let videoObject = try query.getObjectWithId("")
} catch {
print("")
}

Null object comparison in Mockjax causing exception in jQuery

I am attempting to send back stub data via the Mockjax library. The practice is working out for the most part with one exception: the library fails when it tries to do a null comparison of the live and mock data. The Mockjax code is below, the data being sent in is the same as the data in the code snippet.
The error occurs in jQuery (line 630 in my file) when it attempts to find the length of a null object inside of $.each. The version of Mockjax is 1.5.2, the version of jQuery is 1.7.1.
$.mockjax({
url: "service/endpoint",
data: {
elementId : "207710",
floorId : null
},
responseTime: 0,
proxy: '../../07-29-13-all-true.json'
});
Has anyone encountered this and what was your solution? I send null in multiple service calls, so changing that code isn't a great solution at the time.
Any suggestion would be helpful.
Turns out that this was a bug in Mockjax, the fix is in testing now. You can read more about the bug here: https://github.com/appendto/jquery-mockjax/issues/106

Resources