Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to openapi-fetch 0.9.x: Only absolute URLs are supported #1699

Open
jenwirth opened this issue Jun 19, 2024 · 1 comment
Open

Upgrade to openapi-fetch 0.9.x: Only absolute URLs are supported #1699

jenwirth opened this issue Jun 19, 2024 · 1 comment
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library planned Expected in an upcoming version

Comments

@jenwirth
Copy link

Hi,

I am trying to figure why we are getting the following error after updating openapi-fetch from 0.8.x to 0.9.x:

⨯ TypeError: Only absolute URLs are supported
    at new Promise (<anonymous>)
    at Object.getAll (./src/services/location-service.ts:49:22)
    at page (./src/app/locations/page.tsx:18:101)
    at stringify (<anonymous>)

This is the code involved (which did not change between this version update)

const {GET: ssGET} = createClient<paths>({
    baseUrl: AppConfig.ssr.eventServiceBase,
    fetch: fetch
})

I can confirm the baseUrl is set correctly.

and where the error occurs

    async getAll() {
        return await ssGET("/locations")
    },

thanks for any help!

@drwpow
Copy link
Contributor

drwpow commented Jun 19, 2024

Internally there was a change from fetch(url, init) to fetch(new Request(options)) to support middleware. Since this library is still pre-1.0, and it was the first pass at middleware, it was an experiment, but it’s given people problems! So I think we’ll probably revert that internal change and go back to fetch(url, init) in 0.10.0 (which may have a few other minor breaking changes as it will rely on [email protected]). Edit: in 0.10.0 this hasn’t changed; this will remain as fetch(Request).

In pre-1.0 versions, every minor change usually comes with breaking changes, just FYI. At least until 1.0 and beyond, which will follow normal semver.

@drwpow drwpow added bug Something isn't working planned Expected in an upcoming version openapi-fetch Relevant to the openapi-fetch library labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library planned Expected in an upcoming version
Projects
None yet
Development

No branches or pull requests

2 participants