MakeCallback is deprecated

So I’ve created a http-function.js in my backed for an api call that I use myself to get information from my database and compute some maths on my own server. Problem is I’m getting this error:

(node:1) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.

I looked around and found one other similar post:
https://www.wix.com/corvid/forum/community-discussion/error-in-json-deprecationwarning

But the post was not particularly helpful as I do not have any NodeJS modules installed. Is there anything I can do to fix this error on my end or is this a ‘bug’ until fix updates whatever code they have responsible for handling http-functions?

1 Like

More background:
It occurs within wixData.aggregate when I call await results.next();

If I do not use results.next() the error does not occur. I’m still investigating further

It is not a Wix fault as it has been deprecated since Node.js 10, if you stick with Node.js 8 then you can get around it.

Node.js 10+ has deprecated these legacy APIs as they do not provide a mechanism to preserve async context
https://gitlab.mcs-nl.com/public-share/advantech-user-modules/blob/master/nodejs/nodejs.v3/nodejs/lib/node_modules/ffi/node_modules/nan/doc/node_misc.md

Latest node 10 is not supported
https://gitlab.com/gitlab-org/gitter/halley/issues/5

https://fossies.org/linux/node/doc/api/deprecations.json

 "textRaw": "DEP0097: MakeCallback with domain property",
 "name": "dep0097:_makecallback_with_domain_property",
  "meta": {
 "changes": [
 {
 "version": "v10.0.0",
 "pr-url": "https://github.com/nodejs/node/pull/17417",
 "description": "Runtime deprecation."
}
]
},
"desc": "<p>Type: Runtime</p>\n<p>Users of <code>MakeCallback</code> that add the <code>domain</code> property to carry context,\nshould start using the <code>async_context</code> variant of <code>MakeCallback</code> or\n<code>CallbackScope</code>, or the high-level <code>AsyncResource</code> class.</p>\n<p><a id=\"DEP0098\"></a></p>",
"type": "module",
"displayName": "DEP0097: MakeCallback with domain property"
},
{
"textRaw": "DEP0098: AsyncHooks Embedder AsyncResource.emitBefore and AsyncResource.emitAfter APIs",
"name": "dep0098:_asynchooks_embedder_asyncresource.emitbefore_and_asyncresource.emitafter_apis",
"meta": {
"changes": [
{
"version": "v12.0.0",
"pr-url": "https://github.com/nodejs/node/pull/26530",
"description": "End-of-Life"
},
{
"version": [
"v8.12.0",
"v9.6.0",
"v10.0.0"
],
"pr-url": "https://github.com/nodejs/node/pull/18632",
"description": "Runtime deprecation."
}
]
},
"desc": "<p>Type: End-of-Life</p>\n<p>The embedded API provided by AsyncHooks exposes <code>.emitBefore()</code> and\n<code>.emitAfter()</code> methods which are very easy to use incorrectly which can lead\nto unrecoverable errors.</p>\n<p>Use <a href=\"async_hooks.html#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args\"><code>asyncResource.runInAsyncScope()</code></a> API instead which provides a much\nsafer, and more convenient, alternative. See\n<a href=\"https://github.com/nodejs/node/pull/18513\">https://github.com/nodejs/node/pull/18513</a>.</p>\n<p><a id=\"DEP0099\"></a></p>",
"type": "module",
"displayName": "DEP0098: AsyncHooks Embedder AsyncResource.emitBefore and AsyncResource.emitAfter APIs"
},
{
"textRaw": "DEP0099: async context-unaware node::MakeCallback C++ APIs",
"name": "dep0099:_async_context-unaware_node::makecallback_c++_apis",
"meta": {
"changes": [
{
"version": "v10.0.0",
"pr-url": "https://github.com/nodejs/node/pull/18632",
"description": "Compile-time deprecation."
}
]
},
"desc": "<p>Type: Compile-time</p>\n<p>Certain versions of <code>node::MakeCallback</code> APIs available to native modules are\ndeprecated. Please use the versions of the API that accept an <code>async_context</code>\nparameter.</p>\n<p><a id=\"DEP0100\"></a></p>",
"type": "module",
"displayName": "DEP0099: async context-unaware node::MakeCallback C++ APIs"
},

Yes, I agree is is depreciated along with all the supporting documents, but how would I go about using a newer version of Node through Wix? I haven’t seen anything that allows me to use some specific version of Node through their back end code.

If you are wanting to use actual Node.JS through Wix, then you can use them through the Wix Package Manager as shown here.
https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager

With the list of supported nodes shown here.
https://www.wix.com/corvid/npm-modules

If you go the examples page for this Wix Corvid Forum through Documentation in this forum’s heder, then you can see an already made up example for using SendGrid.
https://www.wix.com/corvid/examples
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-send-email-with-the-sendgrid-npm-interface

Otherwise, you will probably just have to make a workaround or use another way of doing something in your Wix HTTP Function.
https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions

This is affecting me too. I can’t make it go away. My HTTP method is POST and the method inside my http-functions.js is declared export function post_workflow(request).

The warning shows up in my site monitor. It doesn’t seem to affect anything but I can’t have this error showing up in my site monitor every time I accept a POST in my API. It’s unacceptable.

Since I’m doing NOTHING SPECIAL other than post (compared to the docs), and since I’m not explicitly referencing node.js, the problem must be in the Wix configuration which I know is built on top of node.js. Wix, can you fix this?

2 Likes