#asommer12-generic-error

1 messages · Page 1 of 1 (latest)

solemn leaf
#

do you have a code snippet & a stack trace?

thick moth
#

I do

#

I am trying to configure Stripe Connect with OAuth

#

        const stripeResponse = await stripe.oauth.token({
          grant_type: scope,
          code: code
        }, {
          idempotencyKey: `${idempotencyKey}-oauth`
        });
#

ReferenceError: GenericError is not defined
at Function.generate (/Users/adamsommer/Documents/repo/kable-dashboard/server/node_modules/stripe/lib/Error.js:52:9)
at res.toJSON.then.StripeAPIError.message (/Users/adamsommer/Documents/repo/kable-dashboard/server/node_modules/stripe/lib/StripeResource.js:220:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

solemn leaf
#

oooh fascinating

#

I think this is a bug in stripe-node - the fallthrough case when handling an unknown error type references GenericError, but that class was removed in a commit almost 3 years ago

thick moth
#

I was thinking the same thing

#

sometimes you know your code is supposed to work haha

solemn leaf
#

I can file a bug report about this, but the question remains - why are you getting an error which has unknown type?

thick moth
#

i have no idea

#

I'm following the exact steps in the Stripe Connect OAuth docs

#

part 4 is the return to my site when I call stripe to connect the account

#

that's where this is failing

#

I'm using valid code/grant-types

solemn leaf
#

^ you shouldn't post access tokens in discord

#

I've deleted the message

thick moth
#

I'm in test mode

#

but yes, sorry

solemn leaf
#

could you paste the application ID (ca_***) that you're using, and I can take a look at the logs

thick moth
#

sorry, what's the application ID? where do i find that?

#

is that the client_id?

#

yea

#

ca_LCG5SdQZBBv5pF9eu75vxpVuzo1QdxMD

solemn leaf
#

yeah, same thing

#

thanks!

thick moth
#

ca_LCG5SdQZBBv5pF9eu75vxpVuzo1QdxMD

#

np

#

still with me?

solemn leaf
#

yep, still looking

thick moth
#

👍

#

I'm also wondering what the usual turnaround time is for fixing bugs like this

solemn leaf
#

there isn't much useful in the logs

#

I think you're going to need to be able to look at the error response to figure out what to do next here

thick moth
#

you don't think the Node SDK will get fixed in the next day or two?

solemn leaf
#

hard to say

#

this bug is presumably pretty obscure, since it's been for 3 years

#

it's unlikely to be an urgent priority, so I don't want to promise a specific timeline

#

I think the most straightforward way to get the error text is to hotpatch the buggy line to console.log the error response

thick moth
#

this is brutal -- I implemented Stripe Connect Direct over the last two days and several hours on Discord with your colleagues -- today I got an update from Stripe that they gave me bad advice and to use OAuth so I've started over

#

now this...

#

(maybe that's helpful context to see what's going on?)

solemn leaf
#

unfortunately, I don't think there's much more directed debugging help I can give you with the logs I have available on my side

#

we can try possible errors at random, but that's going to be painful

thick moth
#

do you have a sense if this is an issue with the SDK or with my account?

#

like should I just code around this?'

#

or am I totally screwed here

solemn leaf
#

I don't think I could hazard a guess here

#

the best advice I can give is to patch the buggy GenericError line to log the response

thick moth
#

okay

#

so how do we do that?

solemn leaf
#

if you edit the Error.js file locally (or on your dev server, etc.) to add a console.log("the mystery error is: " + rawStripeError.type); athttps://github.com/stripe/stripe-node/blob/9bec53e9/lib/Error.js#L52, that should give us something to go on

GitHub

Node.js library for the Stripe API. . Contribute to stripe/stripe-node development by creating an account on GitHub.

thick moth
#

sorry, never edited a Node library directly before, let me try to find how to do this

solemn leaf
#

if you have a text editor, you can just open the file in node_modules and futz with it directly

thick moth
#

okay found it

#

add a log line where Generic Error is thrown?

#

here's the real error:

#

what is the grant type supposed to be?

#

OHHHHHH

#

this might unlock me

#

hang tight

#

YESSSSS

#

we're good

#

hang around here for a few mins if you don't mind

#

i'm gonna see if i cna get this working

solemn leaf
#

sorry, I snipped that message b/c it contained your dashboard cookies

#

but I'm glad you've figured it out!

thick moth
#

lol

#

thank you

solemn leaf
#

lemme send a patch for the bindings issue also

#

the bug here is so trivial, it's simpler than filing a ticket