cloudinary-community / cloudinary-community/next-cloudinary
[Bug] Sentry reports error with `open` function in CldUploadWidget
- Dominant language
- JavaScript
- Stars
- 300
- Forks
- 137
- Avg merge
- 3m
- Merged PRs (30d)
- 2
Description
# **Bug Report**
## **Describe the bug**
Sentry is reporting a:
> TypeError
> Cannot read properties of undefined (reading 'open')
As a result of running the `open` render prop function with CldUploadWidget. I'll share more in a code example below
## **Is this a regression?**
Not sure
## **Steps To Reproduce the error**
1. Add CldUploadWidget to a Next app
2. Use the code below for the implementation
3. Run the app, connected to Sentry
4. See the issue pop up
Here is how I'm running the `open` function:
```js
{({ open }) => {
function handleOnClick(e: React.MouseEvent) {
e.preventDefault();
open();
}
return (
Button
)}}
```
I'm calling this out because it's slightly different than the implementation in your [docs](https://next.cloudinary.dev/clduploadwidget/basic-usage):
```js
{({ open }) => {
return (
open()}>
Upload an Image
);
}}
```
## **Expected behaviour**
Sentry doesn't notice an issue
## **CodeSandbox or Live Example of Bug**
n/a
## **Screenshot or Video Recording**
Attaching a screenshot of Sentry's trace, if it helps
### **Your environment**
- OS: iOS 17.1.1 (client that triggered issue)
- Node version: v18.17.0
- Npm version: 9.6.7
- Browser name and version: Mobile Safari 17.1.1 (client that triggered issue)
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.