question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access API server on localhost

See original GitHub issue

I’m trying to run my ember app against an API server running on my local machine and am getting an error.

Error while processing route: index Ember Data Request GET http://localhost:3000/api/path returned a 0
Payload (Empty Content-Type)
Error: connect ECONNREFUSED 127.0.0.1:3000
    at Object.exports._errnoException (util.js:874:11)
    at exports._exceptionWithHostPort (util.js:897:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14) Error: Ember Data Request GET http://localhost:3000/api/path returned a 0

The target server is rails 4.2.5.1 and works fine against the ember app without fastboot enabled.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dbbkcommented, Apr 29, 2016

I’m also having this issue. Any ideas?

0reactions
jaiminvaja-cuecommented, Apr 25, 2019

@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,

Read more comments on GitHub >

github_iconTop Results From Across the Web

google app engine - Cannot access API explorer on localhost
In any case, when I try to hit that URL, I get immediately redirected to https://developers.google.com/apis-explorer/?base=http://localhost:8080/_ah/api#p/, ...
Read more >
How to access API outside of localhost? · Issue #1152
Let's say my Wireguard IP is 10.0.0.1, then in the config.properties file, I change inference_address=http://10.0.0.1:8080. I'm able to use the API locall.
Read more >
Localhost Refused to Connect Error: 5 Confirmed Ways to ...
Localhost refused to connect error can be caused by an incorrectly configured port, insufficient permissions, or an inoperative web server.
Read more >
Localhost REST service cannot connect
Method URL is set to https://localhost:3000/api/login. I click the TEST tab, and hit TEST button. Says 'Contacting cloud'. Then I get the following...
Read more >
Solved: Unable to access my server hosting api, getting co...
I have a 2 valid swagger.json showing my 2 of my API definitions on the UI. One of my API server is on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found