#Fnky

1 messages ยท Page 1 of 1 (latest)

fierce zodiacBOT
uneven veldt
fiery pecan
#

I'll try that ๐Ÿ‘

uneven veldt
#

heya, so you're you're seeing the error in those screenshots now?

fiery pecan
#

one is from production dev tools, another from Sentry

uneven veldt
#

can you paste your code snippet where you're initializing / mounting the element?

fiery pecan
#

import { useElements } from "@stripe/react-stripe-js"

const elements = useElements()
const element = stripeService.stripeElements.get(type)

where type can be

PAYMENT_METHOD_PRZELEWY24: "p24",
PAYMENT_METHOD_IDEAL: "ideal",
PAYMENT_METHOD_BANCONTACT: "bancontact",
PAYMENT_METHOD_EPS: "eps",
PAYMENT_METHOD_GIROPAY: "giropay",
PAYMENT_METHOD_CARD: "card",

this is the function passed when creating element

const handleReady = () => {
const stripePaymentElement = elements?.getElement(element)
stripePaymentElement &&
stripeService.setStripePaymentElement(stripePaymentElement)
paymentStore.setStatus("done")
scrollToElement()
}

like this

React.createElement(element, {
options: { style: stripeFormStyleObject },
onReady: () => onReady(),
onChange: () => onChange(),
})

uneven veldt
#

okay, are you able to identify which specific line is causing that error?

fiery pecan
#

yes, and as per Sentry, it's this one (getElement)

const stripePaymentElement = elements?.getElement(element)

#

additionally, element renders properly. I can drop loading ( set status on .finally, for example ), but as it then get's passed on to our backed, request fails anyhow.

#

seems to be an issue with stripes .getElement method, but I can't put my finger on it

#

started acting funky last Friday. last changes to frontend was 2 weeks prior, with no apparent changes that could trigger this

#

also, card (credit card) element behaves correctly

#

just those 3 are wonky

deft frost
#

In const element = stripeService.stripeElements.get(type) , what does it return?

#

It looks like the element isn't a valid value

fiery pecan
#

import {
IdealBankElement,
P24BankElement,
EpsBankElement,
CardElement,
P24BankElementComponent,
IdealBankElementComponent,
EpsBankElementComponent,
CardElementComponent,
} from "@stripe/react-stripe-js"

public stripeElements = new Map<PaymentMethod, StripeElementObject>([
[payments.PAYMENT_METHOD_PRZELEWY24, P24BankElement],
[payments.PAYMENT_METHOD_IDEAL, IdealBankElement],
[payments.PAYMENT_METHOD_EPS, EpsBankElement],
[payments.PAYMENT_METHOD_CARD, CardElement],
])

I'll get back to you, got a pretty long meeting! Thanks!

deft frost
#

Yup! I think it will be helpful to log the value of element at the time before const stripePaymentElement = elements?.getElement(element) is called

#

It's likely that the element is null

nova cliff
#

@fiery pecan What's the issue?

fiery pecan
#

still the same ๐Ÿ™‚ I wrote that I'll get back and I'm getting back ๐Ÿ™‚

nova cliff
#

Can you summarise the issue?

fiery pecan
#

With no changes to codebase, since last Friday, 3 payment methods ( P24, iDeal, EPS ) started failing ( and blocking our customers from payment via these methods ). Any idea what's up? I'll add details in thread.

#

this is what happens when I try to mount said elements

#

again, since Friday, hasn't happened on Thursday or any day before that

#

(05.05.2023)

nova cliff
#

What is stripeService.stripeElements.get(type)?

#

And why are you passing that to elements.create()?

fiery pecan
#

to be honest not sure as to "why", I haven't implemented it.

stripeElements.get(type) is a Map that returns StripeElement based on type ( value from clicked chip component )

said element is then passed to React.createElement to pass onReady & onChange, and override styles

nova cliff
#

I don't think your stripeElements.get(type) method/fn is returning that you think it is in this instance, hence the error

fiery pecan
#

yeah I'd assume that as well. Curious as to why it has a day before.

Btw, element itself is rendered properly (?)