Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: get(...) is not a function #32

Open
adambedford opened this issue Mar 21, 2018 · 3 comments
Open

Uncaught TypeError: get(...) is not a function #32

adambedford opened this issue Mar 21, 2018 · 3 comments

Comments

@adambedford
Copy link
Contributor

Running into an issue here where the following error is being thrown:

Uncaught TypeError: get(...) is not a function
    at Class.<anonymous> (stripe-element.js:23)

Looks like get(this, "stripev3.elements") is returning undefined, so calling that function is blowing up. Any idea why this might be happening?

@snewcomer
Copy link
Contributor

@adambedford Are you lazy loading the stripe elements?

@ressom
Copy link

ressom commented Mar 27, 2019

We are seeing the same issue randomishly too. We are currently able to reproduce the issue on Ember 3.1.x and 3.8.x

We discovered a 'fix' that we do not quite understand why it works ... it could, perhaps just be luck.

Previously we loaded StripeV3 in a controller model(...) hook using an Ember.RSVP.hash(...)

  model() {
    return hash({
      someModel: asyncCall(),
      stripeLoader: this.get('stripe').load(),
    });
  },

We changed this to:

  beforeModel() {
    return this.get('stripe').load();
  },

  model() {
    return hash({
      someModel: asyncCall(),
    });
  },

And it appears to have 'fixed' the issue or at least reduced the frequency of failure.

NOTE: that the stripe service in our context is just a light wrapper around the 'stripev3' exported by the addon.

@snewcomer
Copy link
Contributor

I wonder if it is b/c by the time you call get(this, "stripev3.elements"), the service hasn't been put into the container?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants