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

improvement: Update lookupLimit function to use nullish coalescing fo… #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mryraghi
Copy link

@mryraghi mryraghi commented Aug 29, 2023

In order to avoid running updateOrg() on existing users, triggering a re-creation of Stripe customers, leading to duplicates, I've added the metadata tier.org = "org:user_xyz" to existing Stripe customers.

This successfully make Tier recognize the user. However, when running tier.can(), I get:

/node_modules/tier/src/client.ts:506
    for (const usage of limits.usage) {
                               ^
TypeError: limits.usage is not iterable
    at Tier.<anonymous> (/Users/romeo/Development/receiptor/receiptor-backend/node_modules/tier/src/client.ts:506:32)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/romeo/Development/receiptor/receiptor-backend/node_modules/tier/dist/cjs/client.js:8:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Hence, I've added nullish coalescing for more precise default handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant