Closed henryoliver closed 6 years ago
The Trace Agent doesn't prepend generator functions for Koa 2. I think what's happening is that the warning message shows the top line of the stack trace when Koa#use
is being called. Because the Trace Agent wraps this function, it altered the stack trace to add an extra frame to the top as you've observed.
I would expect that when turning off the Trace Agent (by removing the call to start
), the warning message will show a line in your application where a generator is still being used.
Let us know if this solves the issue!
Hi @kjin thanks for your explanation, really appreciate that! But, could you be a little bit more detailed? How could I start the monitor in my Koa2 application without getting this warning? Any code example would be very helpful.
Below is how I currently call the monitor in my application:
// Stackdriver
const trace = require('@google-cloud/trace-agent').start({
projectId: 'polen--project',
serviceContext: {
service: 'glasstone-travel-channel',
version: '1.0.0'
}
});
Getting the message:
koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.md node_modules/@google-cloud/trace-agent/build/src/plugins/plugin-koa.js:99:24
Thanks!
Sure, what I mean is that I suspect you will get a warning even if you comment out the code above. Here's a code example: https://gist.github.com/kjin/e1b9ddcf4360adbdef2e11b939d6a6f2
Can I use the agent without a generator function, since I'm using Koa2? Thanks
Yes, you can! The example shown was just for the sake of showing how the warning changes depending on whether the Trace Agent is started or not.
@henryoliver Were you able to verify whether the warning message comes from use of generators external to the Trace Agent?
@henryoliver Closing this for now. Please comment if this doesn't work for you.
Hey guys!
I'm a paid user for the Google cloud platform and love it.
Could you guys please update the driver for koajs? I start to get the following warning:
Mon, 05 Feb 2018 11:47:29 GMT koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.md at node_modules/@google-cloud/trace-agent/build/src/plugins/plugin-koa.js:99:24
You guys can follow the update instructions here, I think it will be pretty straightforward: https://github.com/koajs/koa/blob/master/docs/migration.md
Thank you for your awesome job in this library! Henry