-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Cannot find module 'next/dist/next-server/server/api-utils.js' from 'node_modules/next-test-api-route-handler/dist/index.js' #320
Comments
Ah, yeah, the NextJS devs have the api-utils in four different locations across several versions 😅. This should be accounted for in the latest version of NTARH (v2.2.1). If you are able to update, does the problem go away? |
So if I update, I end up with a bunch of errors saying that ‘undefined’ should be string value or Array Buffer, or something like that. Can’t remember off the top of my head - for now, I just reverted to Next 11.0.1 and everything works fine!
Will Nixon
Software Developer
310-463-0567
willnixon.dev <https://www.willnixon.dev/>
Lemmi - the app that lets you chat <https://www.lemmichat.com/>
… On Sep 1, 2021, at 4:59 PM, Bernard ***@***.***> wrote:
Ah, yeah, the NextJS devs have the api-utils in four different locations across several versions 😅. This should be accounted for in the latest version of NTARH (v2.2.1). If you are able to update, does the problem go away?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#320 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AH7LOCARUIEKGBRUE5UKTPLT7ZEXVANCNFSM5DGUZI2Q>.
|
Just to be sure: I meant only update NTARH, not NextJS. The latest NTARH should work with the older NextJS v11.0.x (integration tests are passing at least). |
So, updating to 2.2.1 gives me this error: TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
|
Interesting, this seems like the NextJS resolver function itself might have a problem with your handler, since NTARH doesn't call First, does your handler code run in NextJS normally without errors? Second, can you show me the code around your usage of the |
Of course! So, here's an example of how i use testApiHandler: it("should fail if no parameters are passed", async () => { And here's the code for the handler itself: import { VarBinary, MAX, PreparedStatement } from "mssql"; const handler = nextConnect(); handler.post(
} // There's no way for us to convert Strings to SQL Blobs ourselves, so have to use a PreparedStatement here. export default handler; |
Closing this in favor of #378. If this is a different issue and/or this wasn't solved by upgrading to |
The problem
Using Next 11.0.1 and NTARH 2.0.1, when running tests I receive the following error:
Cannot find module 'next/dist/next-server/server/api-utils.js' from 'node_modules/next-test-api-route-handler/dist/index.js'
If I look in the next node_modules folder, the correct path is 'next/dist/server/api-utils.js'
The text was updated successfully, but these errors were encountered: