Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworked javascript workflow examples to use a webserver #1039

Merged
merged 7 commits into from
Jul 30, 2024

Conversation

olitomlinson
Copy link
Contributor

Description

Workflows are better expressed in the context of a webserver (this is how 99% of users will host and author workflows) therefore I've included working examples of how to do this, using native express and Dapr Server.

Issue reference

N/A

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • The quickstart code compiles correctly
  • You've tested new builds of the quickstart if you changed quickstart code
  • You've updated the quickstart's README if necessary
  • If you have changed the steps for a quickstart be sure that you have updated the automated validation accordingly. All of our quickstarts have annotations that allow them to be executed automatically as code. For more information see mechanical-markdown. For user guide with examples see Examples.

@mikeee mikeee closed this Jun 25, 2024
@mikeee mikeee deleted the workflow branch June 25, 2024 07:11
@mikeee mikeee restored the workflow branch June 25, 2024 07:12
@mikeee mikeee reopened this Jun 25, 2024
@mikeee mikeee closed this Jun 25, 2024
@mikeee mikeee reopened this Jun 25, 2024
@paulyuk paulyuk changed the base branch from master to release-1.14 July 28, 2024 18:47
@paulyuk paulyuk requested review from a team as code owners July 28, 2024 18:47
@paulyuk paulyuk self-requested a review July 28, 2024 19:04
@paulyuk paulyuk added this to the 1.14 milestone Jul 28, 2024
@paulyuk paulyuk added P1 language/javascript Pull requests that update Javascript code labels Jul 28, 2024
Copy link
Contributor

@paulyuk paulyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion about env vars. thanks for contribution

@paulyuk
Copy link
Contributor

paulyuk commented Jul 28, 2024

could you also please quick to release-1.14 upstream branch and fix merge conflicts too @olitomlinson ? See comment above too.

Copy link
Contributor

@paulyuk paulyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if checks pass

@paulyuk
Copy link
Contributor

paulyuk commented Jul 29, 2024

When someone from @dapr/approvers-workflows @dapr/maintainers-workflows has time, I cannot figure out why the initial run of the quickstart (using app.ts) is having a timeout exception, when others are not.

dapr run -f .

yields

ℹ️  Validating config and starting app "workflowApp"
ℹ️  Started Dapr with app id "workflowApp". HTTP Port: 65495. gRPC Port: 65496
ℹ️  Writing log files to directory : /Users/paulyuk/src/oli/quickstarts/workflows/javascript/sdk/order-processor/.dapr/logs
== APP - workflowApp == 
== APP - workflowApp == > [email protected] start:order-process
== APP - workflowApp == > npm run build && node dist/app.js
== APP - workflowApp == 
== APP - workflowApp == 
== APP - workflowApp == > [email protected] build
== APP - workflowApp == > npx tsc --outDir ./dist/
== APP - workflowApp == 
== APP - workflowApp == 2024-07-29T22:46:56.345Z INFO [GRPCClient, GRPCClient] Opening connection to 127.0.0.1:65496
== APP - workflowApp == Successfully connected to dns:127.0.0.1:65496. Waiting for work items...
== APP - workflowApp == Workflow runtime started successfully
== APP - workflowApp == Starting new orderProcessingWorkflow instance with ID = a608a714-2569-4a25-8e66-54e29545920f
== APP - workflowApp == Orchestration scheduled with ID: a608a714-2569-4a25-8e66-54e29545920f
== APP - workflowApp == Waiting 30 seconds for instance a608a714-2569-4a25-8e66-54e29545920f to complete...
== APP - workflowApp == TimeoutError: TimeoutError
== APP - workflowApp ==     at Timeout._onTimeout (/Users/paulyuk/src/oli/quickstarts/workflows/javascript/sdk/node_modules/@microsoft/durabletask-js/client/client.js:157:68)
== APP - workflowApp ==     at listOnTimeout (node:internal/timers:569:17)
== APP - workflowApp ==     at process.processTimers (node:internal/timers:512:7)
== APP - workflowApp == Error scheduling or waiting for orchestration: TimeoutError: TimeoutError
== APP - workflowApp ==     at Timeout._onTimeout (/Users/paulyuk/src/oli/quickstarts/workflows/javascript/sdk/node_modules/@microsoft/durabletask-js/client/client.js:157:68)
== APP - workflowApp ==     at listOnTimeout (node:internal/timers:569:17)
== APP - workflowApp ==     at process.processTimers (node:internal/timers:512:7)
== APP - workflowApp == TimeoutError: TimeoutError
== APP - workflowApp ==     at Timeout._onTimeout (/Users/paulyuk/src/oli/quickstarts/workflows/javascript/sdk/node_modules/@microsoft/durabletask-js/client/client.js:157:68)
== APP - workflowApp ==     at listOnTimeout (node:internal/timers:569:17)
== APP - workflowApp ==     at process.processTimers (node:internal/timers:512:7)
The App process exited with error code: exit status 1

@paulyuk
Copy link
Contributor

paulyuk commented Jul 29, 2024

I think I fixed the grpc "Cancelled on client" and timeout issue by moving the workflowWorker.stop call outside of the start loop into a SIGTERM handler, which seems like a better idea anyway. This looks like the same issue as dapr/js-sdk#595

Copy link
Contributor

@paulyuk paulyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paulyuk paulyuk merged commit 309d6b3 into release-1.14 Jul 30, 2024
7 checks passed
@marcduiker
Copy link
Contributor

@holopin-bot @olitomlinson Thanks Oli!

Copy link

holopin-bot bot commented Aug 15, 2024

Congratulations @olitomlinson, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/clzvbo5hg14920cmk0mngoylv

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/workflow language/javascript Pull requests that update Javascript code P1
Projects
Development

Successfully merging this pull request may close these issues.

4 participants