Hi, according to the docs, we can use NUXT_OPEN_FETCH_PETS_BASE_URL=https://petstore3.swagger.io/api/v3/ to set the base url. But, doing so doesn't seem to work.
With
// nuxt.config.ts
[...]
openFetch: {
clients: {
example: {},
},
},
runtimeConfig: {
openFetch: {
example: {
// url for local dev
baseURL: "https://local.example.com",
},
},
},
[...]
public {"baseURL":"https://override.example.com"}
non-public {"baseURL":"https://local.example.com"}
// ==> Correctly uses override.example.com
example error FetchError: [GET] "https://override.example.com/foo": <no response> fetch failed
Note : In my situation, since both the client and the server need access to the URL, it seems like it would be more appropriate to specify this URL in the public property of runtimeConfig. (nuxt docs)
Hi, according to the docs, we can use
NUXT_OPEN_FETCH_PETS_BASE_URL=https://petstore3.swagger.io/api/v3/
to set the base url. But, doing so doesn't seem to work.With
leads to
Setting
NUXT_PUBLIC_OPEN_FETCH_EXAMPLE_BASE_URL
instead leads to the correct result.Note : In my situation, since both the client and the server need access to the URL, it seems like it would be more appropriate to specify this URL in the
public
property ofruntimeConfig
. (nuxt docs)I've just started to use Nuxt, please let me know if I missed something.
Tested with