You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 10, 2021. It is now read-only.
I've got a Next app on Netlify and it works amazing! Thank you for your great work! I've had no problems thus far, except with the following syntax:
exportconstgetServerSideProps: GetServerSideProps=async({ req, res })=>{constauth=awaitauthenticate({ req, res });if(!auth.isLoggedIn){return{redirect: {destination: loginRoute,permanent: false}};}const{ currentUser, access }=auth;constevents=awaitgetEvents();return{props: {
currentUser,
events,},};};
Which returns the error on Netlify:
1:05:13 PM: 2020-11-15T12:05:13.456Z 0d58c161-5d0b-4a41-9724-a1b67fee275f INFO [request] /scheduling
1:05:13 PM: 2020-11-15T12:05:13.600Z 0d58c161-5d0b-4a41-9724-a1b67fee275f ERROR Unhandled error during request: TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received null
at Function.byteLength (buffer.js:726:11)
at sendPayload (/var/task/src/out_functions/next_scheduling/nextJsPage.js:21039:844)
at renderReqToHTML (/var/task/src/out_functions/next_scheduling/nextJsPage.js:16899:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Module.render (/var/task/src/out_functions/next_scheduling/nextJsPage.js:16969:22) {
code: 'ERR_INVALID_ARG_TYPE'
}
1:05:13 PM: 2020-11-15T12:05:13.600Z 0d58c161-5d0b-4a41-9724-a1b67fee275f ERROR TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received null
at Function.byteLength (buffer.js:726:11)
at sendPayload (/var/task/src/out_functions/next_scheduling/nextJsPage.js:21039:844)
at renderReqToHTML (/var/task/src/out_functions/next_scheduling/nextJsPage.js:16899:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Module.render (/var/task/src/out_functions/next_scheduling/nextJsPage.js:16969:22) {
code: 'ERR_INVALID_ARG_TYPE'
}
1:05:13 PM: 2020-11-15T12:05:13.601Z 0d58c161-5d0b-4a41-9724-a1b67fee275f ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError [ERR_INVALID_ARG_TYPE]: The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received null","reason":{"errorType":"TypeError","errorMessage":"The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received null","code":"ERR_INVALID_ARG_TYPE","stack":["TypeError [ERR_INVALID_ARG_TYPE]: The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received null"," at Function.byteLength (buffer.js:726:11)"," at sendPayload (/var/task/src/out_functions/next_scheduling/nextJsPage.js:21039:844)"," at renderReqToHTML (/var/task/src/out_functions/next_scheduling/nextJsPage.js:16899:15)"," at processTicksAndRejections (internal/process/task_queues.js:97:5)"," at async Module.render (/var/task/src/out_functions/next_scheduling/nextJsPage.js:16969:22)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError [ERR_INVALID_ARG_TYPE]: The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received null"," at process.<anonymous> (/var/runtime/index.js:35:15)"," at process.emit (events.js:315:20)"," at processPromiseRejections (internal/process/promises.js:209:33)"," at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
1:05:13 PM: [ERROR] [1605441913603] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 403.
1:05:13 PM: Duration: 153.22 ms Memory Usage: 94 MB Init Duration: 401.18 ms
1:05:13 PM: RequestId: 0d58c161-5d0b-4a41-9724-a1b67fee275f Error: Runtime exited with error: exit status 128
Runtime.ExitError
The real frustrating thing is – this works great locally when running next dev, and even works great when running a site built with next-on-netlify via netlify-cli, but breaks when actually deployed to Netlify. This is visible here.
I'd love to help out and make a PR to fix this if possible. If the issue isn't on this project, but is a general flaw with Netlify Functions, I apologize. I tried to find the best place to report this and this repo seemed ideal.
The text was updated successfully, but these errors were encountered:
@TejasQ thanks so much for the kind words and thorough issue <3! glad next-on-netlify has been helpful for you so far :). hm, this is the first i've [personally] seen of a redirect being returned from gSSP so let me dig a little and we'll make sure to get a test covering this use case with whatever PR we open. will keep you updated!
Thanks for the detailed report and for pointing this out!
Could you try upgrading to next-on-netlify v2.6.3 (latest) and see if that fixes the issue with redirects in getServerSideProps? I just ran a test and it seems to work. Our internal test suite is still fixed to Next v9.5 (because there are some bugs with Next v10 related to preview mode, that we are waiting to resolve before upgrading), but I just tested it manually and I believe it works now.
Hi!
I've got a Next app on Netlify and it works amazing! Thank you for your great work! I've had no problems thus far, except with the following syntax:
Which returns the error on Netlify:
The real frustrating thing is – this works great locally when running
next dev
, and even works great when running a site built withnext-on-netlify
vianetlify-cli
, but breaks when actually deployed to Netlify. This is visible here.I'd love to help out and make a PR to fix this if possible. If the issue isn't on this project, but is a general flaw with Netlify Functions, I apologize. I tried to find the best place to report this and this repo seemed ideal.
The text was updated successfully, but these errors were encountered: