Bug report
Describe the bug
From the documentation:
server target
This is the default target, however, we highly recommend the serverless target.
It is explained that the serverless target will output autonomous modules, one per page, which export kind of wrappers around the http framework and therefore can be used in any cloud serverless function provider (e.g. Google Cloud Functions).
This does work indeed, but then the client code tries to fetch _next/data/{buildID}/{somepage}.json which the documentation doesn't mention.
Therefore, the documentation highly recommends an undocumented feature, which is confusing.
To Reproduce
- Read the doc and contemplate how it is highly recommended to deploy with the
serverless target and use the generated modules
- Make use of the
render method of (for instance) index.js from the build output in .next/serverless/pages/ in the code of a function of your favorite serverless function cloud provider (e.g. Google Cloud Functions)
- Host
.next/static in a _next/static folder so that example.com/static/ uses it, and have example.com/ be served by the cloud function
- Repeat for other routes (for instance map
/another to another cloud function which uses require('serverless/another.js').default.render
- Open
example.com in the browser and in the console watch the browser fail to fetch _next/data/{buildID}/another.json and force a full reload by redirecting to /another instead of using client-side routing navigation
Expected behavior
- Explain in the documentation what is needed to deploy the next.js framework in this highly recommended
serverless configuration: access to disk for caching (and how to disable it in next.config.js), routes to be setup for _next/data and methods to be used (renderReqToHTML ?): not documenting this makes the serverless target kind of pointless while you highly recommend it in the same time
- Please do not merely point to non-official projets (e.g. serverless-next)
System information
N/A (applies to all systems)
Bug report
Describe the bug
From the documentation:
It is explained that the
serverlesstarget will output autonomous modules, one per page, which export kind of wrappers around the http framework and therefore can be used in any cloud serverless function provider (e.g. Google Cloud Functions).This does work indeed, but then the client code tries to fetch
_next/data/{buildID}/{somepage}.jsonwhich the documentation doesn't mention.Therefore, the documentation highly recommends an undocumented feature, which is confusing.
To Reproduce
serverlesstarget and use the generated modulesrendermethod of (for instance)index.jsfrom the build output in.next/serverless/pages/in the code of a function of your favorite serverless function cloud provider (e.g. Google Cloud Functions).next/staticin a_next/staticfolder so thatexample.com/static/uses it, and haveexample.com/be served by the cloud function/anotherto another cloud function which usesrequire('serverless/another.js').default.renderexample.comin the browser and in the console watch the browser fail to fetch_next/data/{buildID}/another.jsonand force a full reload by redirecting to /another instead of using client-side routing navigationExpected behavior
serverlessconfiguration: access to disk for caching (and how to disable it in next.config.js), routes to be setup for_next/dataand methods to be used (renderReqToHTML?): not documenting this makes theserverlesstarget kind of pointless while you highly recommend it in the same timeSystem information
N/A (applies to all systems)