Skip to content

Cloudflare Workers : crossFetch2.fetch is not a function #215

@arkhaiel

Description

@arkhaiel

Hello there,

I'm trying to create a small caldav client on my web app using Nuxt/Nuxt Hub which is using cloudflare workers.
Everything works fine on my local dev server, but when I try to make it work after deploying on cloudflare workers, I have this error, and I'm stuck.

I'm quite new with cloudflare workers and I don't really know how to make it work. Just spent 5 hours trying many things, but I'm not able to get something working.

Any idea ?

Thanks !

My API route is quite simple :

import { createDAVClient } from 'tsdav'

export default defineEventHandler(async (event) => {
  const { appleId, appleOtp } = useRuntimeConfig(event)

  const client = await createDAVClient({
    serverUrl: 'https://caldav.icloud.com',
    credentials: {
        username: appleId,
        password: appleOtp,
    },
    authMethod: 'Basic',
    defaultAccountType: 'caldav',
  })

  const cals = await client.fetchCalendars();
  

  return cals
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions