We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

bffy_smmmers's avatar
bffy_smmmers
Helpful | Level 5
4 years ago

Re: Get thumbnail with TypeScript

hey Greg-DB - when i try that, i get the following:

 

TypeError: fetch is not a function
at /Users/rosiew/Repositories/backend/packages/rest/.webpack/service/handler.js:441710:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    I've moved your comment to its own thread since it's no longer related to the original thread.

     

    How did you install the Dropbox library, and how are you setting up your client object?

    • bffy_smmmers's avatar
      bffy_smmmers
      Helpful | Level 5

      Greg-DB Looks like this for the most part...

       

      import { Dropbox, DropboxAuth, files } from 'dropbox_new';

      import fetch from 'node-fetch';
       
       
      export class DropboxApi {
      private client: Dropbox;
      private manager: Manager;
      private constructor(client: Dropbox) {
      this.client = client;
      }
      static async initialize({ accessToken, }: DropboxCredentials) {
      return new DropboxApi(new Dropbox({ accessToken, fetch }));
      }
       
       
       
      async getThumbnail(path: any) {
      return this.manager.execute(async () => {
      const data: any = this.client
      .filesGetThumbnail({ path })
      .then((response: any) => {
      console.log('got filesGetThumbnail response:');
      console.log(response);
      console.log('got thumbnail data:');
      console.log(response.fileBlob);
      })
      .catch(error => {
      console.log('got filesGetThumbnail error:');
      console.log(error);
      });

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 Following

If 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!