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: Assertion Failed: Expected service:adapter to resolve to an Ember.Service but instead it was [object Object] #1

Closed
RobbieTheWagner opened this issue May 9, 2018 · 13 comments

Comments

@RobbieTheWagner
Copy link
Contributor

I seem to be getting an error trying to inject the service.

Error: Assertion Failed: Expected service:adapter to resolve to an Ember.Service but instead it was [object Object].
    at new EmberError (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/@ember/error/index.js:40:1)
    at assert (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/@ember/debug/index.js:132:1)
    at validateType (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/@ember/application/lib/validate-type.js:23:1)
    at Class.resolve (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/@ember/application/globals-resolver.js:142:1)
    at _resolve (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:889:1)
    at Registry.resolve (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:591:1)
    at Registry.resolve (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:595:1)
    at _has (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:906:1)
    at Registry.has (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:642:1)
    at Registry.validateInjections (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:841:1)
    at FactoryManager.create (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:407:1)
    at instantiateFactory (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:249:1)
    at _lookup (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:181:1)
    at Container.lookup (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/container.js:78:1)
    at Class.lookup (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/ember-runtime/lib/mixins/container_proxy.js:23:1)
    at UnresolvedHandlerInfoByParam.getHandler (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/ember-routing/lib/system/router.js:418:1)
    at UnresolvedHandlerInfoByParam.fetchHandler (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:575:1)
    at UnresolvedHandlerInfoByParam.get (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:734:1)
    at URLTransitionIntent.applyToState (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:1160:1)
    at Router.getTransitionByIntent (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:1473:1)
    at Router.transitionByIntent (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:1280:1)
    at doTransition (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:1908:1)
    at Router.handleURL (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/router.js:1311:1)
    at Class._doURLTransition (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/ember-routing/lib/system/router.js:258:1)
    at Class.handleURL (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/ember-routing/lib/system/router.js:255:1)
    at Class.visit (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/@ember/application/instance.js:189:1)
    at buildAppInstance.then.then (/Users/rwwagner/shipshape/shipshape.io/node_modules/ember-cli-fastboot/node_modules/fastboot/src/ember-app.js:260:28)
    at tryCatcher (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/rsvp.js:200:1)
    at invokeCallback (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/rsvp.js:372:1)
    at publish (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/rsvp.js:358:1)
    at /Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/ember-testing/lib/ext/rsvp.js:14:1
    at invokeWithOnError (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/backburner.js:256:1)
    at Queue.flush (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/backburner.js:167:1)
    at DeferredActionQueues.flush (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/backburner.js:326:1)
    at Backburner._end (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/backburner.js:772:1)
    at Backburner._boundAutorunEnd (/Users/rwwagner/shipshape/shipshape.io/tmp/broccoli_merge_trees-output_path-vbYM6jwK.tmp/assets/backburner.js:484:1)
    at process._tickCallback (internal/process/next_tick.js:178:7)
@tchak
Copy link
Owner

tchak commented May 10, 2018

Can you tell me your app Ember version?

@tchak
Copy link
Owner

tchak commented May 10, 2018

I added an injection test, and really can't see the problem...

I also just found your app source, I will try it later today to see what is happening.

@RobbieTheWagner
Copy link
Contributor Author

The branch I tried it on is https://github.com/shipshapecode/shipshape.io/tree/bssj

@tchak
Copy link
Owner

tchak commented May 22, 2018

The error you are experiencing is in fastboot, right?

@RobbieTheWagner
Copy link
Contributor Author

@tchak yes. You can pull down that branch and run it and see the error by navigating to the blog, and doing a hard refresh, I believe.

@tchak
Copy link
Owner

tchak commented May 23, 2018

@rwwagner90 I am not sure what was the case, but I just tried your branch and it worked with the last version of ember-fetch-adapter. I needed to add hostWhitelist: [/^localhost:\d+$/] though.

@RobbieTheWagner
Copy link
Contributor Author

@tchak I will try the latest, but it doesn't look like anything changed really. I expect the issue to be reproducible. Was there an error without hostWhitelist?

@RobbieTheWagner
Copy link
Contributor Author

@tchak it seems that installing ember-fetch alongside ember-fetch-adapter makes things work again. I supposed having it in dependencies here isn't enough for some reason?

@dfreeman
Copy link

Guessing this is tied to ember-cli/ember-fetch#98?

@RobbieTheWagner
Copy link
Contributor Author

I'm now hitting another issue, trying to use this with prember.

7:27:23 AM: Error while processing route: blog.index Only HTTP(S) protocols are supported TypeError: Only HTTP(S) protocols are supported
7:27:23 AM:     at getNodeRequestOptions (/opt/build/repo/node_modules/node-fetch/lib/index.js:1288:9)
7:27:23 AM:     at /opt/build/repo/node_modules/node-fetch/lib/index.js:1370:19
7:27:23 AM:     at new Promise (<anonymous>)
7:27:23 AM:     at fetch (/opt/build/repo/node_modules/node-fetch/lib/index.js:1367:9)
7:27:23 AM:     at abortableFetch (/opt/build/repo/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js:290:12)
7:27:23 AM:     at n.value [as makeRequest] (/opt/build/repo/tmp/prember-input_base_path-NFp5JPSm.tmp/assets/vendor.js:4358:90)
7:27:23 AM:     at /opt/build/repo/tmp/prember-input_base_path-NFp5JPSm.tmp/assets/vendor.js:4346:170
7:27:23 AM:     at <anonymous>

Any ideas?

@dfreeman
Copy link

@rwwagner90 Yeah, I've seen some weird behavior in Prember where you wind up with the fastboot service reporting a protocol of "undefined:" https://github.com/ember-learn/ember-cli-addon-docs/pull/179/files#diff-4a0c31f2b4c62182ee0685e126f0147fR18

There may be something that needs to be fixed upstream, but in the interim ember-fetch-adapter might want to add an explicit check for that.

@tchak
Copy link
Owner

tchak commented May 30, 2018

I released a new version. Can you try and close this if the problem is solved.

Thanks @rwwagner90 and @dfreeman for working this out!

RobbieTheWagner added a commit to RobbieTheWagner/ember-fetch-adapter that referenced this issue May 30, 2018
@RobbieTheWagner
Copy link
Contributor Author

With the protocol fix and the addition of the blueprint, this issue should be resolved.

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