Skip to content
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

fix(nextjs): Await Next.js server in patched getServerRequestHandler #6072

Merged
merged 1 commit into from Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/nextjs/src/utils/instrumentServer.ts
Expand Up @@ -22,6 +22,7 @@ type PlainObject<T = any> = { [key: string]: T };
// https://github.com/vercel/next.js/blob/4443d6f3d36b107e833376c2720c1e206eee720d/packages/next/server/next.ts#L32
interface NextServer {
server: Server;
getServer: () => Promise<Server>;
createServer: (options: PlainObject) => Server;
}

Expand Down Expand Up @@ -131,7 +132,7 @@ function makeWrappedHandlerGetter(origHandlerGetter: HandlerGetter): WrappedHand
const wrappedHandlerGetter = async function (this: NextServer): Promise<ReqHandler> {
if (!sdkSetupComplete) {
// stash this in the closure so that `makeWrappedReqHandler` can use it
liveServer = this.server;
liveServer = await this.getServer();
const serverPrototype = Object.getPrototypeOf(liveServer);

// Wrap for error capturing (`logError` gets called by `next` for all server-side errors)
Expand Down