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.

Mirrage throws an undefined error even with passthrough enabled.

See original GitHub issue

The code:

import { Server } from "miragejs"

new Server({
  routes() {
    this.passthrough()
  }
})

The fetching code:

return fetch(endpoint + directory + `/${providerName}.json`)

Error message: Mirage: Your app tried to GET ‘http://localhost:8503/providers/…’, but there was no route defined to handle this request. Define a route for this endpoint in your routes() config. Did you forget to define a namespace?

I wanted to mock /api namespace so I tried adding it, no luck, it still throws even tho it has passthrough enabled.

Also I have a question, would mirage have any problems with running multiple instances simultaneously? I’m developing a microfrontend project, all microfronteds run on the same page (not iframe based).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
quentincaffeinocommented, Oct 21, 2020

@samselikoff nice to hear that.

Yeah, I was requesting different address. Sadly can’t test this as I’m no longer using mirage in that project. I found that it is easier to setup simple json server for developing a microfrontend application.

But I really like mirage in my other projects! Thanks for awesome work)

0reactions
samselikoffcommented, Oct 21, 2020

No problem + appreciate you posting. Passthrough + integration is the #1 issue people run into and I think it will make sense to add proper server option (either via node or service worker) to Mirage soon. We are hoping to do it soon after closing existing bugs and shipping a v1.

Sorry again you ran into this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Better default passthrough behavior · Issue #244 - GitHub
and then Mirage would be able to throw an error about undefined route handlers for requests made to /api/* . Anyways, we don't...
Read more >
Configuration - Ember CLI Mirage
By default, if your Ember app makes a request that is not defined in your server config, Mirage will throw an error. You...
Read more >
vue.js - Mirage undefined error (no route defined) when ...
My problem was that my API is running on a different port than my ... By default this.passthrough() only works for requests on...
Read more >
Uncaught TypeError: Cannot read property of undefined
If you get undefined error, you need to make sure that which ever variables throws undefined error, is assigned a value to it....
Read more >
undefined reference to printf assembly - Чернігівеліткартопля
If the integer part of the floating point number cannot fit in the destination type, For a function that returns a possible error...
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