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

Please add more descriptive error message for hostWhitelist property in environment.js #88

Open
valk opened this issue Oct 13, 2016 · 6 comments
Labels

Comments

@valk
Copy link

valk commented Oct 13, 2016

Hi I've no idea what that means. I struggled to understand where this hostWhitelist should be defined without success.

My currently dirty environment.js has this:

  var ENV = {
    modulePrefix: 'gitconfig-client',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
      hostWhitelist: ['localhost'],
    EmberENV: {
      hostWhitelist: ['localhost'],
      FEATURES: {
      hostWhitelist: ['localhost'],
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      },
      EXTEND_PROTOTYPES: {
      hostWhitelist: ['localhost'],
        Date: false,
      }
    },

    APP: {
      hostWhitelist: ['localhost'],
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

And the erro I get when starting FastBoot with:

ember fastboot --port 4200 --host localhost

Is this:

500 Unknown Error: Error: You are using Ember Data with no host defined in your adapter. This will attempt to use the host of the FastBoot request, which is not configured for the current host of this request. Please set the hostWhitelist property for in your environment.js. FastBoot Error: You must provide a hostWhitelist to retrieve the host

@danmcclain
Copy link
Member

danmcclain commented Oct 13, 2016

hostWhitelist is discussed in the User guide here: http://ember-fastboot.com/docs/user-guide
(no link to the proper section, sorry).

@valk
Copy link
Author

valk commented Oct 13, 2016

@danmcclain Ah, thanks! I only read the README 👍

@danmcclain
Copy link
Member

The website is the canonical place for usage information, we shifted away from the README, as it would get unwieldy

@danmcclain
Copy link
Member

I do believe we can add a link to that error message so we can point users in the correct direction, thanks!

@lupestro
Copy link

Will this message also be displayed if there is a whitelist but the host is not on it? Or will there be a different message? If the same message is used for both, providing a more specific message that identifies the host that failed the match would be helpful.

Two small changes to the manual might help with this:

It is very, very easy to put the fastboot:{} in the wrong part of the environment.js. Sounds like the OP was having some confusion about that. In the manual, putting it above the EmberENV: {} and App: {} rather than below them might make it clearer that it has to appear at the let ENV: { ... here ... } level. I had to read it a few times to be sure of that myself.

Also, while ember serve will detect environment.js changes and rebuild the project, I think fastboot may not be picking up its changes under that condition. I had better luck stopping ember serve and restarting it, but I only discovered that by accident after making repeated changes and wondering why I was still getting the error.

@elwayman02
Copy link

Any chance of actually updating this error message as @danmcclain suggested? It's 2020 and the error message is still pretty cryptic. :)

@xg-wang xg-wang added the bug label Feb 9, 2021
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

5 participants