Diizzayy / nuxt-graphql-client

⚡️ Minimal GraphQL Client + Code Generation for Nuxt3
https://nuxt-graphql-client.web.app
MIT License
339 stars 42 forks source link

`graphql-client` not found in runtimeConfig when deploied nuxt3 to fly.io. #483

Open toknT opened 2 months ago

toknT commented 2 months ago

Environment

# run this via fly ssh
$ npx nuxi info
Working directory: /app                                                                   8:54:09 AM
Nuxt project info:                                                                        8:54:09 AM

------------------------------
- Operating System: Linux
- Node Version:     v20.10.0
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  npm@10.2.3
- Builder:          -
- User Config:      ssr, devtools, modules, runtimeConfig
- Runtime Modules:  @element-plus/nuxt@^1.0.9, nuxt-graphql-client@0.2.34
- Build Modules:    -
------------------------------

👉 Report an issue: https://github.com/nuxt/nuxt/issues/new                               8:54:09 AM  

👉 Suggest an improvement: https://github.com/nuxt/nuxt/discussions/new

👉 Read documentation: https://nuxt.com

npm notice 
npm notice New minor version of npm available! 10.2.3 -> 10.5.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.2
npm notice Run npm install -g npm@10.5.2 to update!
npm notice

and it's the nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  ssr: false,
  devtools: { enabled: true },
  modules: ["nuxt-graphql-client"],
  runtimeConfig: {
    public: {
      GQL_HOST: process.env.NUXT_PUBLIC_GQL_HOST,
    },
  },
});

the env in fly

$ fly secrets set NUXT_PUBLIC_GQL_HOST="https://my.url/graphql"
$ fly secrets list  
NAME                    DIGEST                  CREATED AT 
NUXT_PUBLIC_GQL_HOST    fb613ea60e05d7fe        49m7s ago

and it's the screenshot of log console.debug('env',runtimeConfig.public);and error

image

Describe the bug

set GQL_HOST from env cause graphql-client not found. If just write it in nuxt.config.ts like this it still work well

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  ssr: false,
  devtools: { enabled: true },
  modules: ["nuxt-graphql-client"],
  runtimeConfig: {
    public: {
      GQL_HOST: "https://my.url/graphql",
    },
  },
});

Expected behaviour

graphql-client can be used to make request

Reproduction

No response

Additional context

No response

Logs

env Proxy(Object)[[Handler]]: fl_isReadonly: false_isShallow: false[[Prototype]]: ulconstructor: class fldeleteProperty: ƒ deleteProperty(t,n)has: ƒ has(t,n)ownKeys: ƒ ownKeys(t)set: ƒ set(t,n,r,s)[[Prototype]]: Object[[Target]]: ObjectGQL_HOST: "https://my.url/graphql"[[Prototype]]: Object[[IsRevoked]]: false
CLliX2Zu.js:20  Uncaught TypeError: Cannot read properties of undefined (reading '0')
    at CLliX2Zu.js:20:25949