PaddleHQ / paddle-node-sdk

Node.js SDK for working with the Paddle API in server-side apps.
https://developer.paddle.com/
Apache License 2.0
41 stars 6 forks source link

[Bug]: `EventName` not accessible with Supabase Edge Functions. #23

Closed johannbuscail closed 1 week ago

johannbuscail commented 6 months ago

What happened?

Hello, I'm using Paddle Webhooks & Supabase Edge Functions to manage my customers' billing. I want to use this SDK in the Webhooks which work with Deno.

I tried to import this module like any other npm module through:

import { Paddle, EventName, Environment } from "npm:@paddle/paddle-node-sdk@1.2.2";

This doesn't work and returns:

Uncaught SyntaxError: The requested module 'npm:@paddle/paddle-node-sdk@1.2.2' does not provide an export named 'EventName'

Steps to reproduce

  1. Create a supabase webhook
  2. Import the Paddle SDK and EventName enum
  3. Try the webhook

What did you expect to happen?

Access the EventName in Paddle SDK on Edge Functions.

Edit

I don't know if EventName is the only exported thing that's concerned (haven't tested other exports yet).

vijayasingam-paddle commented 6 months ago

Hi @johannbuscail, Thank you for raising this. We will check this issue and get back to you with a fix.

Thank you.

vijayasingam-paddle commented 5 months ago

Hi @johannbuscail, I took a quick look and i was able to replicate the problem.

While i come up with a proper solution, I found that the below snippet works with deno. Please use it temporarily so that you can continue with your integration..

// Import All exported objects
import PaddleSDK from "npm:@paddle/paddle-node-sdk@1.2.2";

// Access `EventName`
if (eventData.eventType === PaddleSDK.EventName.SubscriptionCreated) {
  console.log(eventData)
}

Please let me know if you need any other help. Thank you.

johannbuscail commented 5 months ago

Hey, any update on a proper solution ?

vijayasingam-paddle commented 5 months ago

Hi @johannbuscail, I am sorry, I don't have any updates on this issue. I should have a fix for this in a week or two.

Thank you.

vijayasingam-paddle commented 4 months ago

Hi @johannbuscail, I have made some changes to support deno runtime and released a beta version (1.4.0-beta.0). Please test and let us know if it works for you.

I will let it stay in beta tag for a while before moving it to the latest tag.

Thank you.

vijayasingam-paddle commented 1 week ago

Hi @johannbuscail, I was looking into releasing this change to the latest tag and realized that deno has made some changes on version (1.43.0) and our SDK works well without any change.

I am going to close this issue as it is working with the latest version of deno and will not port the changes to the latest tag.

Please let us know if you need any other help.

Thank you.