I've run the latest npm and now I am seeing the following error:
error: setContext is deprecated, migrate to contexts.set
Nowhere I could find documentation that explains how to use contexts.set. if this is a new feature can you please log the depreciation message as a warning instead of error? at least until setContext is no longer supported.
Thanks
I'm in the same boat. It's not properly documented, I had to rollback versions. They need to show in full what they've broken so we can safely update.
Thanks for letting us know and apologies for the confusion, the warning message should instead read migrate to context.set.
Fixed.
@sarahdwyer
You didn't actually acknowledge my and @gakuba's main concern, which is that this change has been made with no documentation. All the documentation still uses setContext and getContext.
Is it only a syntax change or are there more changes that need to be made to assure the agents work moving forward? Thanks!
@sarahdwyer , the fix worked for me. But I think what you fixed is agent.context.set and agent.context.get. to make it easier for anyone who might read this: just replace agent.setContext with agent.context.set and replace agent.getContext with agent.context.get and your issues should be fixed. As @nathanjliu said, there is no documentation and so some people will have a hard time to know what to do. also since setContext still works, the notification should be logged as a warning rather than an error. I looked into the package and it looks like you are using console.warn but surprisingly it shows in the log as an error.
Thanks for your help and I hope this will help many other people.
@gakuba @nathanjliu Yes we are aware and are working on that, thanks for your concern and attention.
thanks @gakuba my issue is resolved just because of you, live long and prosper
@sarahdwyer , the fix worked for me. But I think what you fixed is agent.context.set and agent.context.get. to make it easier for anyone who might read this: just replace agent.setContext with agent.context.set and replace agent.getContext with agent.context.get and your issues should be fixed. As @nathanjliu said, there is no documentation and so some people will have a hard time to know what to do. also since setContext still works, the notification should be logged as a warning rather than an error. I looked into the package and it looks like you are using console.warn but surprisingly it shows in the log as an error.
Thanks for your help and I hope this will help many other people.
Another related gotcha is that, although agent.setContext(someGoodStuff) works (albeit with a warning), to get it back, you need agent.context.get(somegoodstuff) <- notice that there are no capitals. I don't know if this used to be the case with agent.getContext as I am new to Dialogflow, but it sure had me scratching my head for a good 30 min.
Most helpful comment
@sarahdwyer , the fix worked for me. But I think what you fixed is agent.context.set and agent.context.get. to make it easier for anyone who might read this: just replace agent.setContext with agent.context.set and replace agent.getContext with agent.context.get and your issues should be fixed. As @nathanjliu said, there is no documentation and so some people will have a hard time to know what to do. also since setContext still works, the notification should be logged as a warning rather than an error. I looked into the package and it looks like you are using console.warn but surprisingly it shows in the log as an error.
Thanks for your help and I hope this will help many other people.