You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
skezh1
11 months agoNew member | Level 2
Re: Uncaught TypeError: Dropbox.Dropbox is not a constructor
Hi! This error reappeared again!
- Greg-DBDropbox Staff
skezh1 Thanks for the report. The thread you originally posted in was old, so I've moved this to a new thread.
There hasn't been a new release of the Dropbox JavaScript SDK recently, and I'm not seeing this issue in my own testing now.
I'll be happy to help with any issues you're having with the Dropbox API/SDK, but I'll need some more information. Please reply with:
- the name and version number of the platform and SDK/library you are using
- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
- the full text of any error or unexpected output
- skezh1New member | Level 2
Hi Greg and thank you for replying so quickly!
I've built a web app that had been up for a few years and I did not make any recent updates there, but it started to fail today with the "TypeError: Dropbox.Dropbox is not a constructor" error on the "new Dropbox.Dropbox({accessToken: *** })" (Credentials replaced) line.
I've tried updating the SDK version to the latest (10.34.0 now, and I'm using an older version) - this did not fix the issue. SDK version 5.1.0 that did fix this issue last time - also did not help.
Confused, I went to tutorials, and was able to successfully call dropbox from my app with the "basic" example (https://github.com/dropbox/dropbox-sdk-js/tree/main/examples/javascript/basic) , but I could not find the problem still on why this started to happen. I tried to move the line to the global namespace like in the example - this also did not help.
Eventually, I figured that replacing "new Dropbox.Dropbox" with just "new Dropbox" resolved the issue for me - all the functions were there. I've added a try-catch to try both options for now so that my app will continue working.If I find what the issue was - I will update!
Thank you!
- skezh1New member | Level 2
Found the way to reproduce and the issue!
So, the problem happens if the following library is included after Dropbox-sdk.min.js:
https://www.dropbox.com/static/api/2/dropins.js
Please see example here! https://jsfiddle.net/y9dm8oew/
Run it and open the console to see the error.
- shamilto2000Helpful | Level 6
Unfortunately I am receiving a similar error when using the Embedder, which has worked successfully in my app for years:
Uncaught TypeError: Dropbox.embed is not a function
at dropins.js:1:36970
at E.init (dropins.js:1:37032)
at HTMLDocument.w (dropins.js:1:24186)I tried moving the dropins.js before the sdk inclusion as suggested by another post in the community, but this seems not to resolve it:
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="MY_KEY"></script>
<script src="https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js"></script>
- Greg-DBDropbox Staff
shamilto2000 It looks like you are getting a different error than the one reported in the thread you originally posted in, so I've moved your message to this thread which has the same error you're getting.
Please check out the earlier messages in this thread for ways to handle loading both scripts.
- shamilto2000Helpful | Level 6
I have solved this by removing the line
<script src="https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js"></script>
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,889 PostsLatest Activity: 6 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!