code-corps / ember-stripe-service

An ember-cli addon which injects Stripe as an Ember service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: document is not defined

adambedford opened this issue · comments

I'm getting a ReferenceError: document is not defined error when loading a route with Fastboot that lazy loads Stripe.

Any pointers would be welcomed!

@adambedford Do you protect loading stripe in FastBoot? In a node environment, there is no document.

I'm guessing you want to wait until the browser takes over to get the stripe service (can't do anything with it in node anyways)

if (this.fastboot.isFastBoot) {
  return this.get('stripe').load();
}

https://github.com/ember-fastboot/ember-cli-fastboot#fastboot-service

Let me know if you have other questions!

🙌 You were absolutely right!