Skip to content
This repository was archived by the owner on May 26, 2019. It is now read-only.

[Tutorial] Tests Fail With 404 on /api/rentals after Ember Data step #2280

Closed
acorncom opened this issue Mar 13, 2018 · 5 comments
Closed

[Tutorial] Tests Fail With 404 on /api/rentals after Ember Data step #2280

acorncom opened this issue Mar 13, 2018 · 5 comments

Comments

@acorncom
Copy link
Contributor

Migrated from emberjs/ember.js#16368

I've been following the official Ember tutorial and have been writing the recommended tests along with the app code. After completing the Ember Data step I noticed that all of my acceptance tests were failing with a 404 on the GET request to /api/rentals. I am not seeing this issue with the app code however. The rentals display correctly on the rentals page.

Can anyone with some Ember experience shed some light on what's wrong and/or how to fix it? Thanks.

Promise rejected during "should show rentals as the home page": Ember Data Request GET /api/rentals returned a 404
Payload (Empty Content-Type)
Not found: /api/rentals@ 381 ms
Source:
Error: Ember Data Request GET /api/rentals returned a 404
Payload (Empty Content-Type)
Not found: /api/rentals
at ErrorClass.EmberError (http://localhost:7357/assets/vendor.js:24125:25)
at ErrorClass.AdapterError (http://localhost:7357/assets/vendor.js:157167:15)
at new ErrorClass (http://localhost:7357/assets/vendor.js:157185:22)
at Class.handleResponse (http://localhost:7357/assets/vendor.js:169227:18)
at ajaxError (http://localhost:7357/assets/vendor.js:169720:25)
at Class.hash.error (http://localhost:7357/assets/vendor.js:169308:23)
at fire (http://localhost:7357/assets/vendor.js:3607:31)
at Object.fireWith [as rejectWith] (http://localhost:7357/assets/vendor.js:3737:7)
at done (http://localhost:7357/assets/vendor.js:9646:14)
at XMLHttpRequest. (http://localhost:7357/assets/vendor.js:9887:9)

/cc @rayascott

@acorncom
Copy link
Contributor Author

@rayascott This sounds like you may not have made the changes to mirage/config.js mentioned in this section? https://guides.emberjs.com/v3.0.0/tutorial/installing-addons/#toc_ember-cli-mirage

That setup should indeed work ...

If you find you're still hitting snags, we'd love to get you unstuck. We find that it's sometimes more satisfying to get these snags worked out in realtime. If that'd be helpful for you as well, feel free to join us in the Ember community slack at https://ember-community-slackin.herokuapp.com. There's both a #-help channel and a #-team-learning channel (where we'd love to discuss snags that exist in the tutorial).

Let me know if that helps!

@rayascott-zz
Copy link

@acorncom I have indeed made the changes to mirage/config.js, in the add-ons step, so not sure why this is happening. I'll join in the Slack community, when I can. Thanks!

@toddjordan
Copy link
Contributor

toddjordan commented Mar 14, 2018

Hi @rayascott one thing I find useful is looking at the official super rentals repo here: https://github.com/ember-learn/super-rentals

One known issue is that mirage came out with version 0.4.2 requiring you to call setupMirage in your test. https://github.com/samselikoff/ember-cli-mirage/releases/tag/v0.4.2

See #2272. We will fix this as soon as we can, but until then you can work around by installing mirage 0.4.1 or adding the setup call

Thanks so much for reporting, though, and continue to let us know where the tutorial needs fixing. Your feedback is appreciated.

@toddjordan
Copy link
Contributor

Issued a PR to update the text around mirage setup: #2290

@acorncom
Copy link
Contributor Author

Fixed by #2290

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

No branches or pull requests

3 participants