Skip to content

Commit

Permalink
fix -workflowtype stripped
Browse files Browse the repository at this point in the history
  • Loading branch information
antmendoza committed Apr 18, 2024
1 parent 022d78f commit fb5ce79
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nextjs-ecommerce-oneclick/pages/api/startBuy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export default async function startBuy(req, res) {
// Workflows will be started in the "default" namespace unless specified otherwise
// via options passed the Client constructor.
const client = new Client({ connection });

// When the project is built, the bundler will strip out Workflow function names.
// This ensures the workflow type remains the same
// when the client send the request to Temporal Server. Another option is modifying the webpack config,
// as it is stated here https://docs.temporal.io/dev-guide/typescript/debugging#production-bundling
Object.defineProperty(OneClickBuy, 'name', { value: 'OneClickBuy' });

// kick off the purchase async
await client.workflow.start(OneClickBuy, {
taskQueue: 'ecommerce-oneclick',
Expand Down

0 comments on commit fb5ce79

Please sign in to comment.