Skip to content

AbortController signal in nuxt with openapi-ts creates an errorΒ #2713

@debloisg

Description

@debloisg

Description

Hi,
I'm trying to add an AbortController signal to a GET openapi endpoint. The function has been auto-generated with openapi-ts. It works fine when I'm trying to call it with a normal $fetch, but doesn't with the generated method.

// Working code
const results = await $fetch(`/search`, {
  method: 'GET',
  signal: abortController.signal,
  query: {
    // Query params
  },
})
// Not working code
const results = await searchSearchGet({
  path: {
    // Path params        
  },
  signal: abortController.signal,
  query: {
    // Query params
  },
  composable: '$fetch',
})

The resulting error is:

myfile.vue:xxx FetchError: [GET] "https://xxxxx.xxx/search": <no response> Failed to execute 'fetch' on 'Window': Failed to read the 'signal' property from 'RequestInit': Failed to convert value to 'AbortSignal'.

Do you have any idea ?

Reproducible example or configuration

No response

OpenAPI specification (optional)

      '@hey-api/nuxt':
        specifier: 0.2.1
        version: 0.2.1
      '@hey-api/openapi-ts':
        specifier: 0.83.1
        version: 0.83.1

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug πŸ”₯Something isn't workingclientClient package related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions