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

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

Open
toknT opened this issue Apr 24, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@toknT
Copy link

toknT commented Apr 24, 2024

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:  [email protected]
- Builder:          -
- User Config:      ssr, devtools, modules, runtimeConfig
- Runtime Modules:  @element-plus/nuxt@^1.0.9, [email protected]
- 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 [email protected] 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
@toknT toknT added the bug Something isn't working label Apr 24, 2024
@toknT toknT changed the title graphql-client not found in in runtimeConfig when deploied nuxt3 to fly.io. graphql-client not found in runtimeConfig when deploied nuxt3 to fly.io. Apr 24, 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
Projects
None yet
Development

No branches or pull requests

1 participant