Custom server buildId missing
See original GitHub issueWhat version of Next.js are you using?
12.0.7
What version of Node.js are you using?
16.13.1
What browser are you using?
chrome
What operating system are you using?
ubuntu server
How are you deploying your application?
custom
Describe the Bug
Trying to use build id on a custom server (for assetPrefix) but seems like it was removed so now I’m not able to use it as it was moved under server which is private.
export declare class NextServer {
private serverPromise?;
private server?;
private reqHandlerPromise?;
private preparedAssetPrefix?;
options: NextServerOptions;
constructor(options: NextServerOptions);
get hostname(): string | undefined;
get port(): number | undefined;
getRequestHandler(): RequestHandler;
setAssetPrefix(assetPrefix: string): void;
logError(...args: Parameters<Server['logError']>): void;
render(...args: Parameters<Server['render']>): Promise<void>;
renderToHTML(...args: Parameters<Server['renderToHTML']>): Promise<string | null>;
renderError(...args: Parameters<Server['renderError']>): Promise<void>;
renderErrorToHTML(...args: Parameters<Server['renderErrorToHTML']>): Promise<string | null>;
render404(...args: Parameters<Server['render404']>): Promise<void>;
serveStatic(...args: Parameters<Server['serveStatic']>): Promise<void>;
prepare(): Promise<void>;
close(): Promise<any>;
private createServer;
private loadConfig;
private getServer;
private getServerRequestHandler;
}
Expected Behavior
Maybe have a public builId ?
To Reproduce
const app = next({ dev });
app.prepare().then(() => {
if (process.env.CDN_PATH) {
app.setAssetPrefix(`${process.env.CDN_PATH}/${app.buildId}/`);
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Configuring the Build ID - Next.js
Configure the build id, which is used to identify the current build in which your application is being served.
Read more >How to get a BuildID from a SessionId? - Playfab Community
If there's something I'm missing, then, how can I retrieve the BuildId based on the SessionId? ... MatchmakingCustom Game Servers. Comment.
Read more >RHEL8 rpmbuild and /usr/lib/.build-id - Red Hat Customer Portal
In RHEL7, I was able to separate my custom installations into /usr/local, keeping them well away from the official RH software.
Read more >NextJS cannot find a valid build in the '.next' directory
Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id.
Read more >How To Deploy Next.js on Multiple Servers - Level Up Coding
In other terms, you may end up losing almost all the benefits coming ... As mentioned here, Next.js allows you to define a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Now that
Server
is wrapped byNextServer
and is a private variable, we are unable to accessbuildId
without ignoring the TS error. This is true for all of the previously publicServer
values, like therouter
which housesdynamicRoutes
.Many of these things are necessary in order to properly build out a custom server. Why were they made private?
😐 Dude … I’m talking about about a Typescript interface and you close this topic without understanding the issue … Then you show me JS code …