Skip to content

Commit fb5ce79

Browse files
committed
fix -workflowtype stripped
1 parent 022d78f commit fb5ce79

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

nextjs-ecommerce-oneclick/pages/api/startBuy.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export default async function startBuy(req, res) {
1818
// Workflows will be started in the "default" namespace unless specified otherwise
1919
// via options passed the Client constructor.
2020
const client = new Client({ connection });
21+
22+
// When the project is built, the bundler will strip out Workflow function names.
23+
// This ensures the workflow type remains the same
24+
// when the client send the request to Temporal Server. Another option is modifying the webpack config,
25+
// as it is stated here https://docs.temporal.io/dev-guide/typescript/debugging#production-bundling
26+
Object.defineProperty(OneClickBuy, 'name', { value: 'OneClickBuy' });
27+
2128
// kick off the purchase async
2229
await client.workflow.start(OneClickBuy, {
2330
taskQueue: 'ecommerce-oneclick',

0 commit comments

Comments
 (0)