miragejs / ember-cli-mirage

An Ember Addon to easily add Mirage JS to your Ember app.
http://ember-cli-mirage.com
MIT License
863 stars 441 forks source link

mirage enabled even when using `--proxy` flag #2558

Closed Techn1x closed 11 months ago

Techn1x commented 11 months ago

It looks like this PR https://github.com/miragejs/ember-cli-mirage/pull/2495 released 2 weeks ago under 3.0.0-alpha.4 has removed the config/environment.js file

That config/environment.js file had a usingProxy() function that would set ENV['ember-cli-mirage'].usingProxy to true if proxy flag was set https://github.com/miragejs/ember-cli-mirage/pull/2495/files#diff-77d6e2aab53cbf594475ecab6eac3882cd95a1c3d95085833caa58c39cb0a910L4-L11

When usingProxy is true, that would disable mirage server in the initializer https://github.com/miragejs/ember-cli-mirage/blob/dc3852505a18fae1abde78ef13dc9add9a30c057/packages/ember-cli-mirage/app/initializers/ember-cli-mirage.js#L54

Right now nothing sets that usingProxy property in the config, so mirage ends up being enabled even when proxies are set

This seems like an unintentional change (wasn't mentioned in 3.0.0 Breaking Changes)

Techn1x commented 11 months ago

cc @deepfryed

SergeAstapov commented 11 months ago

@Techn1x sorry for churn, fix published in v3.0.1

Techn1x commented 11 months ago

Thanks so much! You do great work! I am just glad to see things moving in mirage land :)

ijlee2 commented 10 months ago

@Techn1x @SergeAstapov I appreciate the report and the quick response, as my team encountered a related issue on 3.0.0. Updating ember-cli-mirage to 3.0.1 fixed our problem, and the update from 2.4.0 to 3.0.0 went otherwise smoothly. ✨

Even after updating to 3.0.1, one of our developers found that the issue exists on their Windows machine. By temporarily updating the Mirage config to passthrough all requests, the requests to the desired server worked:

function routes() {
  this.passthrough();
  // removed all other overrides
}

We're not sure yet if the Windows issue is an existing one, either in ember-cli-mirage or miragejs. If we can come up with a minimal reproducible app (I imagine this will take time, as we would need to create an Ember app as well as a Rails/Node server), we'll let you know.

(Could be hard-coded / in paths like https://github.com/miragejs/ember-cli-mirage/pull/2559/files#diff-77d6e2aab53cbf594475ecab6eac3882cd95a1c3d95085833caa58c39cb0a910R14.)

SergeAstapov commented 10 months ago

@ijlee2 thank you for the pull request! This is released as v3.0.2