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

Error using RestSerializer #19

Open
joemoded opened this issue Dec 20, 2017 · 2 comments
Open

Error using RestSerializer #19

joemoded opened this issue Dec 20, 2017 · 2 comments
Labels

Comments

@joemoded
Copy link

joemoded commented Dec 20, 2017

Hi @dfreeman,

So as I mentioned in Slack yesterday, my team and I are trying to integrate ember-cli-pact with our repo, which uses a RestSerializer, and have come across the error "`Invalid attempt to destructure non-iterable instance."

After downloading your repo and ensuring all tests were passing, I was then able to reproduce the error in your repo by changing the mirage application.js file to the following:

import { RestSerializer } from 'ember-cli-mirage';
import { PactEnabled } from 'ember-cli-pact/mock-provider/mirage';

export default class ApplicationSerializer extends PactEnabled(RestSerializer) {

}

If you're able to offer any insight that would be awesome. Thanks in advance!

@dfreeman dfreeman added the bug label Jan 16, 2018
@dfreeman
Copy link
Member

dfreeman commented Jan 16, 2018

Hi @joemoded,

Essentially the issue here is that different Mirage serializers return different types of values from getHashForResource (which isn't technically a public hook). It's definitely something we should solve properly here, but it has some interesting implications for dealing with how side-loaded resources are managed, so it's going to take some thought.

In the short term, you should be able to work around this by adding something like the following to your serializer:

import { RestSerializer } from 'ember-cli-mirage';
import { PactEnabled } from 'ember-cli-pact/mock-provider/mirage';

export default class ApplicationSerializer extends PactEnabled(RestSerializer) {
  // Workaround for https://github.com/salsify/ember-cli-pact/issues/19
  getMatchingRulesForResource() {
    return [super.getMatchingRulesForResource(...arguments)];
  }
}

@louiseavelar
Copy link

Hello, sorry to bother here in another thread but.. How can I get someone to help on my issue? #32

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

No branches or pull requests

3 participants