Comments (8)
I have exactly the same issue and I'm trying to figure out about how to solve it. I'm not able to use Next Link or App Router because it looks that "Mirage" intercepts it.
However, I discover that, if I comment server.passthrought()
from my mirage settings, it will works (links will work), but it will also display an error on browser inspector saying: "ailed to fetch RSC payload. Falling back to browser navigation.".
from miragejs.
@maorazoulay If I might suggest a possible simpler solution? You could be to rely on 'use client'
as per the link I gave and create a React component you can just import:
'use client'
import { createServer } from "mirage";
createServer();
export default function MirageServer(): null { return null }
This worked for me.
from miragejs.
Here is the only solution (workaround) that worked for me:
- create a mirage.js file [https://miragejs.com/quickstarts/nextjs/develop-an-app/#step-2-define-your-shared-server](like this) with an async method that contains createServer() and returns the server. I created it at the root of my project.
- within the app folder, create a component and from a useEffect within that component call the makeServer method from mirage.js.
- In your root layout, Render that component as part of your html and then you are all set. No more 404s.
from miragejs.
Are you telling the Next server to run it on the client side?
Without it, createServer()
will be executed on the server and won't intercept your network requests.
from miragejs.
Regardless of the solution used to setup mirage on the client side, this won't fix navigation unfortunately...
Clicking a next link / using useRouter methods will either
- throw
Failed to fetch RSC payload ...
with no passthrough - throw an obscure react-dom error
TypeError: Cannot read properties of undefined (reading 'getReader')
with passtrough on (similar issue here it seems?)
🥲
from miragejs.
The error TypeError: Cannot read properties of undefined (reading 'getReader')
is still ocurring when using this.passthrough()
configuration on createrServer > routes > this.passthrough()
, what i have done is delete this.passthrough()
because with that your navigation is going to work just fine , but i still do no what to do about next js route-handlers because without this.passthrough()
in the code this make a beetwen mirage js and next Js using App router (Next 13 or Above)
from miragejs.
Related Issues (20)
- Example using GraphQL and React Native for Testing HOT 2
- How to fix it? my error is: Mirage: Passthrough request for GET /_next/static/development/_devMiddlewareManifest.json
- `timing` setting does not respect `environment: 'test'` without setting `testConfig` HOT 2
- Seeding doesn't load factories HOT 1
- `Response` object is using deprecated `@ember/error` HOT 1
- Can some updates be made so all config elements can be modularized in all environments including development?
- Issues running inside a webpack based NX monorepo React app HOT 3
- `Serializer.normalize()` not called if request body is `FormData`
- How do you include relationships when mixing the JSON API and Rest serializers? HOT 3
- Argument of type '{ name: string; role: string[]; }' is not assignable to parameter of type 'Partial<ModelInitializ HOT 1
- Change default request handling
- Allow timing to be boolean, default to 'false' due to Pretender handling HOT 6
- Doesn't work with vue3 + fetch + passthrough HOT 2
- Next-pwa throws Failed to execute 'put' on 'Cache': parameter 2 is not of type 'Response' with simple Miraje configuration
- Mirage.js Endpoints Not Found After Navigating and Reloading in Lazy-Loaded Angular App HOT 1
- New Docs Proposal HOT 3
- Firebase `onSnapshot` intercepted
- Composable/extendable traits
- Miragejs not allowing base64 image having lengthy URL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miragejs.