mangopay intergation in node js. Could not create user - node.js

I am integrating mangopay in node js and I am using npm for mangopay2-nodejs-sdk.but when I use api.Users.create function for creating user ,it gives me error
Debug: internal, implementation, error
TypeError: Uncaught error: Cannot read property 'userClass' of undefined
at Service.extend.create (/home/hashir/artpaie/artapieapp/artapieBackend/node_modules/mangopay2-nodejs-sdk/lib/services/Users.js:38:41)

The error handler in _getUserApiAndClass method seems not to be working, my problem was that I didn't have specified the PersonType.
It is uppercase
Natural: 'NATURAL'
Legal: 'LEGAL'

Related

I'm trying to deploy a nextjs app to vercel but get this error <TypeError: Cannot read properties of null (reading 'id')>

when I was deploying the nextjs application to vercel i get errors after the app fetch the data from external api (in heroku).
Error occurred prerendering page "/pt/post/site-dja-sta-quate-online". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'id')
at Postid (/vercel/path0/.next/server/pages/post/[id].js:85:28)
and
Error occurred prerendering page "/pt/experiencias/terra-sua-lua". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'attributes')
at Expid (/vercel/path0/.next/server/pages/experiencias/[id].js:371:72)
and
> Build error occurred
Error: Export encountered errors on following paths:
/en
/fr
/pt
/pt/experiencias/terra-sua-lua
/pt/experiencias/terra-system-e-bunita
/pt/post/li-fogo-na-bran-bran-ya
/pt/post/site-dja-sta-quate-online
at /vercel/path0/node_modules/next/dist/export/index.js:487:19
the logs said that the properties are null, and this is not the case.
Now i'm tring to fix that problem with no success, who knows what append here?
this is the github link for the project
https://github.com/TerraSystemWS/zebraTravelWebUI/tree/main/pages/experiencias
https://github.com/TerraSystemWS/zebraTravelWebUI/tree/main/pages/post

Promise.allSettled is not a function with node 14.0.0

I'm trying to start an app which includes a simple Promise.allSettled(), but it crashes at start with the following error :
UnhandledPromiseRejectionWarning: TypeError: Promise.allSettled is not a function
I looked it up, and most answers are related to allSettled not being available before node 12.9, but I'm running v14.0.0
How can I fix this ?

Browserify / Electron / AngularJS Error: fs.existsSync is not a function

I'm getting a Error: fs.existsSync is not a function code after I bundle my code using Browserify.
Before I've tried to use require() but I kept getting Error: require is not defined due to require function not supported on client side. Browserify seems a solution to use. I've managed to solve require error with browserify but another one came up - fs.existsSync is not a function.
Here is the error code as shown on my console:
Error: fs.existsSync is not a function
[159]</</sqlite.prototype.connect#http://127.0.0.1:8080/services/bundle.js:169566:35
[160]</<#http://127.0.0.1:8080/services/bundle.js:169992:29
invoke#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4718:19
enforcedReturnValue#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4557:37
invoke#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4718:19
createInjector/protoInstanceInjector<#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4517:37
getService#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4664:39
injectionArgs#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4688:58
instantiate#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:4730:18
$controller#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:10369:28
compile/<#http://127.0.0.1:8080/views/assets/js/vendors/angular-ui-router.js:4081:28
bind/<#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:1247:18
invokeLinkFn#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:9934:9
nodeLinkFn#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:9335:11
compositeLinkFn#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:8620:13
publicLinkFn#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:8500:30
lazyCompilation#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:8844:25
updateView#http://127.0.0.1:8080/views/assets/js/vendors/angular-ui-router.js:4021:23
compile/</<#http://127.0.0.1:8080/views/assets/js/vendors/angular-ui-router.js:3959:11
$broadcast#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:18005:28
transitionTo/$state.transition<#http://127.0.0.1:8080/views/assets/js/vendors/angular-ui-router.js:3352:22
processQueue#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:16383:28
scheduleProcessQueue/<#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:16399:27
$eval#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:17682:28
$digest#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:17495:31
$apply#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:17790:24
done#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:11831:47
completeRequest#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:12033:7
requestLoaded#http://127.0.0.1:8080/views/assets/js/vendors/angular.js:11966:9
<div ui-view="" class="ng-scope">
I'm using electron, angularjs and sqlite to build my app but I'm stuck on this error, any help will be appreciated.
I've managed to solve my error without browserify by enabling nodeIntegration: true in main.js file (electron entry file). Then I was able to load my script (coolscript.js) which has require function inside of it to my html without problems -
<script>
require('coolscript.js')
</script>

Geddy/NodeJS scaffold error

I'm new into node.js and i chose geddy to start one sample app.
I tried to execute this command:
geddy scaffold news title:string
but when I run the application, i received an error
Error: 500 Internal Server Error
TypeError: ejs:11
<%- linkTo(news[i].title, newsPath(news[i].id)); %>
string is not a function
at handleErr (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:58:15)
at Object.rethrow (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:90:41)
at eval (eval at (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:88:10), :2:925)
at C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:101:17
at ejs.render (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\adapters\ejs.js:28:10)
at Adapter.render (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\adapters\index.js:122:22)
at Partial.renderSelf (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\partial.js:128:28)
at handleData (C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\partial.js:101:16)
at C:\Users\tschl_000\AppData\Roaming\npm\node_modules\geddy\lib\template\partial.js:119:9
at fs.js:266:14
i think that this error is happening by the singular/plural problem,
because when i removed the call to "newsPath", this worked.
Anyone know how to make it work?

node.js send object from server to client console for debugging

How can I pass an object from server to client make it looking like this in the console?
I tried to use util.inspect(myObject, {showHidden: false, depth: null}),
but it returns a string and I cannot fold/unfold it in the console:
I tried to convert it to an object using var obj = JSON.parse(str);, but it gives me an error:
Uncaught SyntaxError: Unexpected token S in JSON at position 0
or var obj=eval("("+str+")");, but it gives me an error:
Uncaught SyntaxError: Unexpected token {
If you are using devtool or node monkey to connect node.js to your console, then you can simply use:
console.log(myObject);
Or for a more detailed view:
console.dir(myObject);
Node Inspector seems to have (had?) some issues with console ouput.
If you wish to log to stderr instead of stdout you can use:
console.error('%o',myObject)

Resources