apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Cannot assign null or empty value for authType configuration

Open Lytan89 opened this issue 1 year ago • 1 comments

Environment


  • Operating System: Darwin
  • Node Version: v18.15.0
  • Nuxt Version: 3.12.4
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: runtimeConfig, devtools, ssr, modules, apollo, css, build, vite, app, imports, compatibilityDate
  • Runtime Modules: @nuxtjs/[email protected], @pinia/[email protected], ()
  • Build Modules: -

Describe the bug

When I was trying to set empty or null value for authType, it returns me error of 'Cannot convert undefined or null to object' and the error seems causing by serializeConfig function. This issue seems working fine with @nuxtjs/[email protected] but not for the release after this.

Expected behaviour

I should be able to set empty/null value for authType.

Reproduction

No response

Additional context

No response

Logs

No response

Lytan89 avatar Oct 25 '24 10:10 Lytan89

I have faced this issue and identified the root cause, it's caused by the condition checking for handling object/array.

In the code below, it did not consider the fact that typeof null === 'object'

https://github.com/nuxt-modules/apollo/blob/64e35de7bcfc5f45cd6571841593610646868e7f/src/serialize.ts#L13-L19

wuiyang avatar May 23 '25 19:05 wuiyang