NextJs setPreviewData on Netlify Functions

Site Name: https://neu-neu-production.netlify.app/

I’m trying to get Netlify to work with Next js Previews and Wordpress.
next-on-netlify is installed and working and the route /api/preview?slug=[slug] is deployed and accessible.

The function work until it tries to set the preview cookies via:
res.setPreviewData({
page: {
id: page.databaseId,
slug: page.slug,
status: page.status,
},
})

The error in my netlify function log is:
10:28:47 AM: 2021-02-17T10:28:47.562Z fa2a25c7-7c51-45af-addc-2496dbe03c87 INFO [request] /api/preview
10:28:47 AM: 2021-02-17T10:28:47.568Z fa2a25c7-7c51-45af-addc-2496dbe03c87 INFO approach
10:28:48 AM: 2021-02-17T10:28:48.749Z fa2a25c7-7c51-45af-addc-2496dbe03c87 INFO { databaseId: 16, slug: ‘approach’, status: ‘publish’ }
10:28:48 AM: 2021-02-17T10:28:48.752Z fa2a25c7-7c51-45af-addc-2496dbe03c87 ERROR TypeError: e[t] is not a function
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.293 (/var/task/src/nextPage.js:10147:29747)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.118 (/var/task/src/nextPage.js:10147:28826)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.692 (/var/task/src/nextPage.js:10147:17036)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.28 (/var/task/src/nextPage.js:10147:15901)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.27 (/var/task/src/nextPage.js:10147:3078)
10:28:48 AM: 2021-02-17T10:28:48.752Z fa2a25c7-7c51-45af-addc-2496dbe03c87 ERROR TypeError: e[t] is not a function
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.293 (/var/task/src/nextPage.js:10147:29747)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.118 (/var/task/src/nextPage.js:10147:28826)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.692 (/var/task/src/nextPage.js:10147:17036)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.28 (/var/task/src/nextPage.js:10147:15901)
at webpack_require (/var/task/src/nextPage.js:10147:30130)
at Object.27 (/var/task/src/nextPage.js:10147:3078)
10:28:48 AM: 2021-02-17T10:28:48.752Z fa2a25c7-7c51-45af-addc-2496dbe03c87 ERROR Unhandled Promise Rejection {“errorType”:“Runtime.UnhandledPromiseRejection”,“errorMessage”:“TypeError: e[t] is not a function”,“reason”:{“errorType”:“TypeError”,“errorMessage”:“e[t] is not a function”,“stack”:[“TypeError: e[t] is not a function”," at webpack_require (/var/task/src/nextPage.js:10147:30130)"," at Object.293 (/var/task/src/nextPage.js:10147:29747)"," at webpack_require (/var/task/src/nextPage.js:10147:30130)"," at Object.118 (/var/task/src/nextPage.js:10147:28826)"," at webpack_require (/var/task/src/nextPage.js:10147:30130)"," at Object.692 (/var/task/src/nextPage.js:10147:17036)"," at webpack_require (/var/task/src/nextPage.js:10147:30130)"," at Object.28 (/var/task/src/nextPage.js:10147:15901)"," at webpack_require (/var/task/src/nextPage.js:10147:30130)"," at Object.27 (/var/task/src/nextPage.js:10147:3078)"]},“promise”:{},“stack”:[“Runtime.UnhandledPromiseRejection: TypeError: e[t] is not a function”," at process. (/var/runtime/index.js:35:15)"," at process.emit (events.js:314:20)"," at processPromiseRejections (internal/process/promises.js:209:33)"," at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
10:28:48 AM: Duration: 1195.90 ms Memory Usage: 74 MB Init Duration: 164.71 ms
10:28:48 AM: Unknown application error occurred

The function works fine locally.

Hiya @grantmac and sorry to be slow to get back to you! Our dev team took a look with us and we think that this is the issue you were hitting: Preview mode broken in Next 10.0.2 with target: "serverless": TypeError: e[t] is not a function · Issue #99 · netlify/next-on-netlify · GitHub (comments include the upgrade that should fix things for you).

Check it out and let me know if that guides you to a fix or not, please!