Post Purchase Authentication Error

am trying to follow the following tutorial https://shopify.dev/docs/apps/checkout/product-offers/post-purchase/getting-started#step-2-test-the-extension
Till step 2 its working fine and showing the post purchase offer

When I implemented the step 3 its not showing the post purchase offer instead its showing an error in the terminal

TypeError: __vite_ssr_import_1__.authenticate.public is not a function
14:25:15 │ remix │ at action (/Users/Documents/extension-postpurchase/app/routes/api.offer.jsx:13:39)

We have only changed the product information in offer.server.js rest code is same as provided above.

I have try this with both versions node 18 and 21

Can you please confirm whats an issue here?

I had the same problem as you and eventually solved it this way.
According to API Docs: https://shopify.dev/docs/api/shopify-app-remix/v1/authenticate/public/checkout#example-cors

// const { cors } = await authenticate.public(request)
// Replace it with:

const { cors } = await authenticate.public.checkout(request, { corsHeaders: ["X-My-Custom-Header"] });

Saved me! Thx

Thank you! This saved me.