Open chiragp9 opened 4 months ago
To assist you with the error you're encountering with your custom activity in Elsa Studio, I would need to see the specific error message that is displayed when you drop the activity into the studio. The screenshot you mentioned seems to be missing or not properly linked, as I cannot view it.
However, based on the code snippet you provided for your custom activity, the code appears to be correctly structured according to the documentation for creating custom activities in Elsa 3.0. If you're following the documentation correctly but still encountering an error, it could be due to several reasons such as:
To further diagnose the issue, please provide the following information:
Program.cs
or Startup.cs
file where you register your custom activity.Once you provide this information, I'll be able to give you more targeted advice on how to resolve the issue.
I have updated issue. Please look at it and give me resolution.
I created a custom activity as per a below link, but I am getting an error as attached in screenshot when I call that activity from postman. https://v3.elsaworkflows.io/docs/extensibility/custom-activities
Error Stack: MongoDB.Driver.MongoBulkWriteExceptiong__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Elsa.Http.Middleware.WorkflowsMiddleware.InvokeAsync(HttpContext httpContext)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context)
at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
1[Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord]: A bulk write operation resulted in one or more errors. WriteErrors: [ { Category : "Uncategorized", Code : 52, Message : "The dollar ($) prefixed field '$type' in 'ActivityState.WelComeNote.$type' is not valid for storage." } ]. at MongoDB.Driver.MongoCollectionImpl
1.BulkWriteAsync(IClientSessionHandle session, IEnumerable1 requests, BulkWriteOptions options, CancellationToken cancellationToken) at MongoDB.Driver.MongoCollectionImpl
1.UsingImplicitSessionAsync[TResult](Func2 funcAsync, CancellationToken cancellationToken) at Elsa.MongoDb.Common.MongoDbStore
1.SaveManyAsync(IEnumerable1 documents, CancellationToken cancellationToken) at Elsa.MongoDb.Modules.Runtime.MongoWorkflowExecutionLogStore.SaveManyAsync(IEnumerable
1 records, CancellationToken cancellationToken) at Elsa.Workflows.Runtime.Middleware.Workflows.PersistWorkflowExecutionLogMiddleware.InvokeAsync(WorkflowExecutionContext context) at Elsa.Workflows.Runtime.Middleware.Workflows.PersistActivityExecutionLogMiddleware.InvokeAsync(WorkflowExecutionContext context) at Elsa.Workflows.Runtime.Middleware.Workflows.PersistBookmarkMiddleware.InvokeAsync(WorkflowExecutionContext context) at Elsa.Workflows.Runtime.Middleware.Workflows.PersistentVariablesMiddleware.InvokeAsync(WorkflowExecutionContext context) at Elsa.Workflows.Runtime.Middleware.Workflows.ScheduleBackgroundActivitiesMiddleware.InvokeAsync(WorkflowExecutionContext context) at Elsa.Workflows.Pipelines.WorkflowExecution.WorkflowExecutionPipeline.ExecuteAsync(WorkflowExecutionContext context) at Elsa.Workflows.Services.WorkflowRunner.RunAsync(WorkflowExecutionContext workflowExecutionContext) at Elsa.Workflows.Services.WorkflowRunner.RunAsync(Workflow workflow, RunWorkflowOptions options, CancellationToken cancellationToken) at Elsa.Workflows.Runtime.Services.WorkflowHost.StartWorkflowAsync(StartWorkflowHostOptions options, CancellationToken cancellationToken) at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.StartWorkflowAsync(IWorkflowHost workflowHost, StartWorkflowRuntimeOptions options) at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.StartWorkflowAsync(IWorkflowHost workflowHost, StartWorkflowRuntimeOptions options) at Elsa.Workflows.Runtime.Services.DefaultWorkflowRuntime.StartWorkflowAsync(String definitionId, StartWorkflowRuntimeOptions options) at Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Execute.Execute.HandleAsync(Request request, CancellationToken cancellationToken) at FastEndpoints.Endpoint2.ExecAsync(CancellationToken ct) at FastEndpoints.Endpoint
2.ExecAsync(CancellationToken ct) at Microsoft.AspNetCore.Routing.EndpointMiddleware.HEADERS
Accept: / Connection: keep-alive Host: localhost:7237 User-Agent: PostmanRuntime/7.36.1 Accept-Encoding: gzip, deflate, br Content-Type: application/json Content-Length: 10 Postman-Token: be042bf3-303f-4a87-ba49-426a6a65ed0e
Below is the code for the activity. namespace Elsa3Server { public class Welcome : CodeActivity
{
public Input WelComeNote { get; set; } = default!;
}