question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'host' of undefined

See original GitHub issue

General information

  • SDK version: tested on 3.81.1 and 3.39.0
  • Environment: Sandbox
  • Browser and OS: Chrome/71.0.3578.62 on Arch Linux (Kernel Version: 4.19)

Issue description

(node:46) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'host' of undefined
at /app/node_modules/braintree-web/client/get-configuration.js:21:38
at new Promise (<anonymous>)
at getConfiguration (/app/node_modules/braintree-web/client/get-configuration.js:17:10)
at /app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33
at Function.Client.initialize (/app/node_modules/braintree-web/client/client.js:124:13)
at Object.create (/app/node_modules/braintree-web/client/index.js:38:17)
at Object.create (/app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33)
at Object.create (/app/node_modules/braintree-web-drop-in/index.js:527:17)
at Object.create (/app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33)
at VueComponent.createDropIn (pages/index.js:117:68)
at VueComponent.created (pages/index.js:107:10)
at callHook (/app/node_modules/vue/dist/vue.runtime.common.js:2919:21)
at VueComponent.Vue._init (/app/node_modules/vue/dist/vue.runtime.common.js:4628:5)
at new VueComponent (/app/node_modules/vue/dist/vue.runtime.common.js:4796:12)
at createComponentInstanceForVnode (/app/node_modules/vue-server-renderer/build.js:7353:10)
at renderComponentInner (/app/node_modules/vue-server-renderer/build.js:7527:40)

(node:46) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

(node:46) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the 
future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hi, i’m facing a small issue which doesn’t affect the web application at all. but thought of leave it on the issues for just in case. Please let me know if more info is needed. Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
crookedneighborcommented, Nov 28, 2018

By mock the Braintree calls, I meant, mock the methods.

Example using sinon:

var sinon = require('sinon');
var fakeClient = {};
var fakeHostedFields = {
  tokenize: sinon.stub().yields(null, {nonce: 'a-nonce'})
};

sinon.stub(braintree.client, 'create').yields(null, fakeClient);
sinon.stub(braintree.hostedFields, 'create').yields(null, fakeHostedFields);
0reactions
crookedneighborcommented, Jul 7, 2020

We’ve switched over from global -> window in v3.63.0, which should take care of your issue @saraedum

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js TypeError: Cannot read property 'host' of undefined
I think the problem is that you have a typo in config.js . You are using module.export instead of module.exports , so you're...
Read more >
Cannot read property 'host' of undefined - WordPress.org
Hi,. I have setup your plugin and added all details up to date. but on my checkout page plugin show Cannot read property...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
[SOLVED] Cannot Read Property of Undefined in JavaScript
The “cannot read property of undefined” error occurs when you attempt to access a property or method of a variable that is undefined...
Read more >
TypeError: Cannot read properties of undefined (reading 'host')
The error is likely because conn.connection is null, and you're trying to access the property host on it. Try logging conn rather than...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found