Closed paulelliott closed 8 years ago
I'm also having this issue. Any ideas?
What port is the rails app on? How is the ember app configured with regards to the above request? The Ajax request you're making is pointed to your fastboot server currently
Please comment if you are having this issue still
I'm also facing the same issue. No idea why.
@adityasingh-ruckus can you provide more details? How are you attempting to hit your API?
Thanks for reaching out @danmcclain
My APIs are hosted on my local server, and I can validate the response using HTTPRequester (Firefox add-on). However, when I try to send an API request using the browser, I get this error:-
Error while processing route: allprofiles.index Ember Data Request GET http://localhost:5000/thisprofiles returned a 0 Payload (Empty Content-Type)
EmberError@http://localhost:4200/assets/vendor.js:26672:15 AdapterError@http://localhost:4200/assets/vendor.js:71016:5
Here is how my JSONAdapter looks:-
export default JSONAPIAdapter.extend({ host:'http://localhost:5000', headers:{ 'Authentication': 'my_auth_key', 'Content-Type': ' application/json', 'Access-Control-Allow-Origin': '*' } });
Does your API get the proper request from fastboot? Are you on the latest beta of ember-cli-fastboot?
I haven't installed fastboot. I had installed mirage and I thought once the APIs were ready, a simple JSONAdapter would do. This is the first time I am using ember cli so there might be something which I have missed.
This is the fastboot repo, the fact that you are seeing this issue without fastboot means it may be an ember data issue
@danmcclain
I am using fastboot, it is working fine with static data and auth pages where I don't need authentication.
But it has issue when an API needs Authorization.
Error while processing route: task Ember Data Request GET http://embertaskapi.test/api/tasks returned a 401
Payload (application/json)
[object Object] Error: Ember Data Request GET http://embertaskapi.test/api/tasks returned a 401
Payload (application/json)
[object Object]
at ErrorClass.AdapterError (/tmp/broccoli-14672NmFqyPFKCSXO/out-218-broccoli_merge_trees/assets/addon-tree-output/ember-data/-private.js:6175:1)
at new ErrorClass (/tmp/broccoli-14672NmFqyPFKCSXO/out-218-broccoli_merge_trees/assets/addon-tree-output/ember-data/-private.js:6203:1)
at Class.handleResponse (/tmp/broccoli-14672NmFqyPFKCSXO/out-218-broccoli_merge_trees/assets/addon-tree-output/ember-data/adapters/rest.js:801:1)
at ajaxError (/tmp/broccoli-14672NmFqyPFKCSXO/out-218-broccoli_merge_trees/assets/addon-tree-output/ember-data/adapters/rest.js:1093:1)
at ajaxErrorHandler (/tmp/broccoli-14672NmFqyPFKCSXO/out-218-broccoli_merge_trees/assets/addon-tree-output/ember-data/adapters/rest.js:1139:1)
at Object.hash.error (/tmp/broccoli-14672NmFqyPFKCSXO/out-218-broccoli_merge_trees/assets/addon-tree-output/ember-data/adapters/rest.js:884:1)
at fire (/var/www/html/hands-on-ember/node_modules/jquery-deferred/lib/jquery-callbacks.js:78:30)
at Object.fireWith (/var/www/html/hands-on-ember/node_modules/jquery-deferred/lib/jquery-callbacks.js:188:7)
at Object.fire [as reject] (/var/www/html/hands-on-ember/node_modules/jquery-deferred/lib/jquery-callbacks.js:195:10)
at onError (/var/www/html/hands-on-ember/node_modules/najax/lib/najax.js:208:9)
at dataHandler (/var/www/html/hands-on-ember/node_modules/najax/lib/najax.js:173:9)
at IncomingMessage.<anonymous> (/var/www/html/hands-on-ember/node_modules/najax/lib/najax.js:198:9)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Here is my package.json dependency list.
"devDependencies": {
"@ember/jquery": "^0.5.2",
"@ember/optional-features": "^0.6.3",
"babel-eslint": "^10.0.1",
"broccoli-asset-rev": "^2.7.0",
"ember-ajax": "^4.0.1",
"ember-auto-import": "^1.2.21",
"ember-cli": "~3.8.1",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.1.2",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^4.2.3",
"ember-cli-fastboot": "^2.0.4",
"ember-cli-htmlbars": "^3.0.0",
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-uglify": "^2.1.0",
"ember-confirmbox-addon": "0.0.1",
"ember-data": "~3.8.0",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.1.0",
"ember-local-storage": "^1.7.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^3.4.1",
"ember-resolver": "^5.0.1",
"ember-source": "~3.8.0",
"ember-welcome-page": "^3.2.0",
"eslint-plugin-ember": "^5.2.0",
"loader.js": "^4.7.0",
"qunit-dom": "^0.8.0"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
},
"dependencies": {
"crypto-js": "^3.1.9-1",
"lodash": "^4.17.11"
},
"fastbootDependencies": [
"rsvp",
"path"
]
Here is the error that I am facing. Your help will be highly appreciated.
Thanks,
I'm trying to run my ember app against an API server running on my local machine and am getting an error.
The target server is rails 4.2.5.1 and works fine against the ember app without fastboot enabled.