Setting up Sentry (Raven) with Sail.js - javascript

I am quiet new to sails.js and currently trying to integrate sentry with it. I read up the following tutorial on it.
https://docs.sentry.io/clients/node/
But i am not able to register error on sentry if i use patchGlobal command, it works on local errors when i declare it env/production file but if i define it in other places it doesn't even register local errors.
I also tried integrating it as a middleware but i am not able to integrate it correctly since the link they have provided is for express.
https://docs.sentry.io/clients/node/integrations/express/
Any help would be really appreciated !
Thanks

This might be a solution to your problem:
https://www.npmjs.com/package/sails-hook-sentry

In the end , i was able to use Winston to log errors using Sentry in Sails. Following is the link:
https://github.com/guzru/winston-sentry

Related

TypeError: cleanUrl is not a function while creating a React Project

Hey everybody I am getting this error after hosting a website on firebase or I am not sure about it.
It's the replace-info.js screenshot.
I am not able to find the solution on stackoverflow or on other website.
This error had appeared on my side after npm update npm#lastest
What I did to fix it:
Go to AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-fetch\lib\index.js.
Add module.exports.cleanUrl = require('./clean-url.js') at the end of the file.
P.S. I just copied it from there https://github.com/npm/npm-registry-fetch/blob/main/lib/index.js

Keep getting an error when trying to place button from Semantic UI into code. error is Error: Unable to find node on an unmounted component

I am trying to work on this side project I am using with a MERNG stack. The issue I am getting is when I am trying to add a button from my semantic UI react documents into my code. The button I am trying to add is from this source https://react.semantic-ui.com/elements/button/#types-labeled-basic-shorthand. Whenever I try to implement that code I get that error and I do not know exactly why my error is occuring. My GitHub Repo is https://github.com/Hoybaby/React-Social-App. I am currently Hiding my config.js which is the connection to my database with a secret key being secret key. Please Help. Image of Code in PostCard.js in components.
The error is this. Error On Screen
Similar questions can be found here and here.
I would suggest trying to update all the dependencies - I see no clear source of that error, however lots of your dependencies are deprecated.

How to integrate tesseract OCR with Cordova/Phonegap app

Im trying use tesseract OCR with my app and by instructions posted here
http://scn.sap.com/community/developer-center/front-end/blog/2015/05/15/create-an-ocr-android-app-with-cordova-and-tesseract
several times I followed the instructions but with no success.When im inspecting code with Google Chrome Dev console thru the WebVieW it give me
Uncaught SyntaxError: Unexpected token }
in file tesseractPlugin.js:11
thats located somewhere in
file:///android_asset/www/plugins/com.tesseract.phonegap/tesseractPlugin/tesseractPlugin.js
and
Uncaught Error: Module com.tesseract.phonegap.tesseractPlugin.TesseractPlugin does not exist.
in cordova.js:1431
witch i think means the cordova cant find the plugin but i dont know why.I think it's something with the version of Cordova and its access to plugins
its frustrating because there are no other options on the web and i dont know how to write my own cordova plugin.
I would also like to add that I created the project exactly as instructed to avoid the mistakes and over I have found that it is not possible to download the plugin by git from
https://github.com/engzhaowei/Tesseract-phonegap-android-example/tree/master/plugins/com.tesseract.phonegap.tesseractPlugin
so i downloaded full package and fetch plugin from
C:\xxx\plugins\com.tesseract.phonegap.tesseractPlugin
There is tessaract js http://tesseract.projectnaptha.com/
which is a javascript library and you can use it and will work for phonegap its very easy to implement.
Just reference the cdn script in the header and call the code snippet it should work. Be warned actress is slow.
<script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>
var myimage = document.getElementById("largeImage").src;
Tesseract.recognize(myimage)
.then(function(result){
// console.log(result);
document.getElementById("textarea1").value = result.text; // assign results to a textbox

Angular js deployment on web server issue

I've developed my first spa application in Angular js but I've done it on localhost.
Now it's time to test it online. I'm sure that everything works localy but simply I can't make it work online.
It seems to me like controllers are not being loaded although they are linked well.
Routing works because html templates change but THERE ARE NO CONTROLLERS ???.
Here is sample output from console :
First,for every controller in my app I get this (total 5 times) :
Uncaught SyntaxError: Unexpected token <
And after that I get this for controller that is being used right now:
Error: [ng:areq] http://errors.angularjs.org/1.3.5/ng/areq?p0=homeCtrl&p1=not%20aNaNunction%2C%20got%20undefined
at Error (native)
at https://code.angularjs.org/1.3.5/angular.min.js:6:416
For every single controller I get the same error.
I followed rule to inject dependacys (found that on stackowerflow but it doesn't help at all) so my every controller looks like this:
myApp.controller('nearCtrl',
['$scope', 'geolocation', 'nearApartments', 'uiGmapGoogleMapApi',
function ($scope, geolocation, nearApartments, uiGmapGoogleMapApi) {...}])
Does anyone have an idea what could I do to fix this ?
Ok I found the solution,as usual it was trivial and now I feel like I shot myself in leg.
The thing was that I was very stupid and didn't follow good
practices as NAMING CONVENTION from the BEGINING of the
project !
In my index.html file there was an issue because few controllers were named by lowercase like myController.js and their real name on server was different like MyController.js so there's a problem.
I worked with git,merged branches and stuff and probabbly git messed up something with names(explains how it worked on localhost I guess) but that wouldn't happen if I had followed rules from the start.
To every wannabe Angular.js developer like me there are some great design guides and good practices described on link below.
Use them !
https://github.com/mgechev/angularjs-style-guide
Tnx everyone who tried to help me, Angular has really great community.
The trouble is with your server routing. You're serving your whole app instead of the individual JS files. First thing you should do is make sure 188.226.150.65/app/components/about/aboutController.js serves correctly the JS for aboutController.js.
Looking at each of your component folders, it seems all your controller.js files all have the same error:
Error in exception handler: The stream or file "/var/www/html/zimmer-
production/app/storage/logs/laravel.log" could not be opened: failed to open stream:
Permission denied in /var/www/html/zimmer-production/bootstrap/compiled.php:9016
The only controllers that seem to actually have any Javascript are the signup controllers and the apartmentControler. I'd check the permissions in your production environment, as that seems to be the problem.

Apache Cordova ContactFind

Okay so for the past two days I've been struggling to get my first Cordova/Eclipse project up and running. I'm trying to retrieve the contacts from my phone, using the ful sample code provided on the Apache Cordova website. http://cordova.apache.org/docs/en/2.5.0/cordova_contacts_contacts.md.html
But it's not working. I keep getting this error: "Uncaught ReferenceError: ContactFindOptions". And yes, I have included the needed plugin using the Cordova CLI. I also tried adding it manually, to no avail.
// Cordova is ready
function onDeviceReady() {
// find all contacts with 'Bob' in any name field
var options = **new ContactFindOptions()**;
options.filter="Bob";
var fields = ["displayName", "name"];
navigator.contacts.find(fields, onSuccess, onError, options);
}
I also included the Cordova.js file in my btw. I'm at a complete loss here, and all I can find about this particular problem are more people asking this question, without an answer that works for me :(
It seems I'm supposed to answer my own question instead of putting the answer in the edit.
Okay, so I figured it out by trial and error. Apparently sometimes Cordova doesn't update the Cordova_plugins.js file after adding plugins with the CLI. So you need to run the 'build' command from the project folder in CLI.
So when you get the Uncaught ReferenceError warning, just check your cordova_plugins.js. If it's not updated do it manually!
Hope I can help someone with the same issues by providing this solution, however 'green' it might be.

Categories