Closed tequdev closed 2 years ago
This is due to the same handler being reused (from ./handler
). This is already noted in the README: https://github.com/hoangvvo/next-connect#common-errors
DO NOT reuse the same instance of nc like the below pattern:
// middleware/common export default nc().use(a).use(b); // api/foo import Handler from "middleware/common"; export default Handler.get(x); // api/bar import Handler from "middleware/common"; export default Handler.get(y);
Sorry for the lack of reading of the document.
Thanks.
reproduce: https://github.com/develoQ/next-connect-issue-repro
Call 2 api from frontend.
First render, Both hello1, hello2 are correctly called.
after first render, when Reload, A is called twice or B twice.
frontend log
backend log
Looking at backend log, api path is correct but path handling is something wrong.