Closed ahmelsayed closed 6 years ago
From @anthonychu on July 4, 2018 22:34
Try running this to get a later version of Microsoft.Azure.DocumentDB.Core
which will restore the interop dll properly:
func extensions install -p Microsoft.Azure.DocumentDB.Core -v 2.0.0-preview
More details here: https://github.com/Azure-Samples/functions-serverless-chat-app-tutorial/issues/1
From @jdneo on July 5, 2018 1:32
@anthonychu Thank you for reaching out. But I'm still getting this error after running the command.
From @mariomeyrelles on July 5, 2018 12:52
In my case I was running node and not java.
I had to be absolutely sure that the indirect dependency, Microsoft.Azure.Documents.ServiceInterop.dll
is present on the \bin folder. Adding Microsoft.Azure.DocumentDB.Core
in my case:
Another important thing: I ran this sample using real CosmosDB database and collection. I'm not sure if the emulator is good enough for this kind of scenarios.
The image below shows how things are set on my sample:
Sorry for the confusion. Looks like something is wrong with my environment. Just tried this again and every thing is fine.
@ahmelsayed I think we can close this issue.
Met same error on my side. Init a node function project and new a cosmosdb trigger template.
Got result like @jdneo had. After installing Microsoft.Azure.DocumentDB.Core
as @anthonychu suggests, it works.
Use CosmosDB trigger template in VSCode, got new error with cli-beta.37.
Code
module.exports = async function (context, documents) {
if (!!documents && documents.length > 0) {
context.log('Document Id: ', documents[0].id);
}
}
extensions.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<WarningsAsErrors/>
<DefaultItemExcludes>**</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.1-beta2"/>
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.0"/>
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.0.0-preview2"/>
</ItemGroup>
</Project>
Error message
Microsoft.Azure.Documents.ChangeFeedProcessor: Method not found: 'System.Threading.Tasks.Task`1<Microsoft.Azure.Documents.Client.ResourceResponse`1<Microsoft.Azure.Documents.Document>> Microsoft.Azure.Documents.Client.DocumentClient.ReadDocumentAsync(System.Uri, Microsoft.Azure.Documents.Client.RequestOptions)'.
Complete Cli output
Azure Functions Core Tools (2.0.1-beta.37)
Function Runtime Version: 2.0.12050.0
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\john\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
info: Host.Startup[0]
Reading host configuration file 'C:\Users\john\Desktop\mycosjs\host.json'
info: Host.Startup[0]
Host configuration file read:
{
"version": "2.0"
}
[9/2/2018 12:45:05 PM] Initializing Host.
[9/2/2018 12:45:05 PM] Host initialization: ConsecutiveErrors=0, StartupCount=1
[9/2/2018 12:45:06 PM] Starting JobHost
[9/2/2018 12:45:06 PM] Starting Host (HostId=mycat-1685544341, InstanceId=a7d8f7de-947e-4612-a4f9-ede87cd67ebf, Version=2.0.12050.0, ProcessId=41932, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
[9/2/2018 12:45:06 PM] Starting language worker process:node --inspect=5858 "C:\Users\john\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\node\dist/src/nodejsWorker.js" --host 127.0.0.1 --port 53221 --workerId f887d6ee-6ed1-4c4a-b11d-e7215f3c2196 --requestId 818eefce-d6c3-492e-a464-081b493d1d91 --grpcMaxMessageLength 134217728
[9/2/2018 12:45:06 PM] node process with Id=35288 started
[9/2/2018 12:45:06 PM] Generating 1 job function(s)
[9/2/2018 12:45:06 PM] Debugger listening on ws://127.0.0.1:5858/be9b8258-23d7-4de0-9bfd-3db6a9cc7665
[9/2/2018 12:45:06 PM] For help see https://nodejs.org/en/docs/inspector
[9/2/2018 12:45:07 PM] Worker f887d6ee-6ed1-4c4a-b11d-e7215f3c2196 connecting on 127.0.0.1:53221 []
[9/2/2018 12:45:09 PM] Found the following functions:
[9/2/2018 12:45:09 PM] Host.Functions.CosmosTriggerJavascript
[9/2/2018 12:45:09 PM]
[9/2/2018 12:45:09 PM] Host initialized (3823ms)
[9/2/2018 12:45:17 PM] The listener for function 'Functions.CosmosTriggerJavascript' was unable to start.
[9/2/2018 12:45:17 PM] The listener for function 'Functions.CosmosTriggerJavascript' was unable to start. Microsoft.Azure.Documents.ChangeFeedProcessor: Method not found: 'System.Threading.Tasks.Task`1<Microsoft.Azure.Documents.Client.ResourceResponse`1<Microsoft.Azure.Documents.Document>> Microsoft.Azure.Documents.Client.DocumentClient.ReadDocumentAsync(System.Uri, Microsoft.Azure.Documents.Client.RequestOptions)'.
[9/2/2018 12:45:17 PM] Host started (11411ms)
[9/2/2018 12:45:17 PM] Job host started
Hosting environment: Production
Content root path: C:\Users\john\Desktop\mycosjs
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...
[9/2/2018 12:45:19 PM] Retrying to start listener for function 'Functions.CosmosTriggerJavascript' (Attempt 1)
[9/2/2018 12:45:19 PM] The listener for function 'Functions.CosmosTriggerJavascript' was unable to start.
[9/2/2018 12:45:19 PM] The listener for function 'Functions.CosmosTriggerJavascript' was unable to start. Microsoft.Azure.Documents.ChangeFeedProcessor: Host was already initialized.
Same error with Azure Functions Core Tools (2.0.1-beta.38)
Microsoft.Azure.WebJobs.Extensions.CosmosDB 3.0.1-beta1 - CreateDocumentAsync Microsoft.Azure.WebJobs.Extensions.CosmosDB 3.0.1-beta2 - ReadDocumentAsync
And looks like the issue is in
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.0.0-preview2"/>
After downgrading to 1.9.1 - can run locally.
For Azure Environment: Make sure that FUNCTIONS_EXTENSION_VERSION set to ~2
Confirm no error with latest 3.0.1 CosmosDB extensions. Issue can be closed.
Closed as resolved.
@brettsam can you please add the PR/Commit details?
A duplicate issue is here: https://github.com/Azure/azure-webjobs-sdk-extensions/issues/432
Was fixed with: https://github.com/Azure/azure-webjobs-sdk-extensions/pull/433
From @jdneo on July 4, 2018 9:16
Here is the logs:
Copied from original issue: Azure/azure-functions-core-tools#569