Skip to content

Missing useRuntimeConfig values on Lambda #706

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

Closed
tuan-bui opened this issue Feb 13, 2023 · 0 comments
Closed

Missing useRuntimeConfig values on Lambda #706

tuan-bui opened this issue Feb 13, 2023 · 0 comments

Comments

@tuan-bui
Copy link

Environment


  • Operating System: Darwin
  • Node Version: v14.21.1
  • Nuxt Version: 2.16.0
  • Nitro Version: 1.0.0
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: nitro, router, head, css, plugins, dir, storybook, buildModules, modulesDir, modules, i18n, app, runtimeConfig, publicRuntimeConfig, alias, typescript, build, serverHandlers, devServerHandlers, devServer, bridge
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: (), @nuxt/[email protected], @nuxtjs/[email protected]

Reproduction

  • Reproduction this issue is tricky as it requires Lambda
  • Install the latest Nuxt Bridge version
  • Add a new test endpoint test.get
  • Add a page that calls the endpoint using asyncData
  • Add basic logging into the endpoint before calling useRuntimeConfig:
  console.log(process.env);
  console.log(useRuntimeConfig());
  • Modify the nuxt.config.ts:
runtimeConfig: {
    cmsApiKey: "",
    cmsDeliveryToken: "",
    cmsManagementToken: "",
}
  • Set the NITRO_PRESET environment variable to aws-lambda and build the project
  • Deploy the project to Lambda with the expected values NUXT_CMS_API_KEY, NUXT_CMS_DELIVERY_TOKEN, NUXT_CMS_MANAGEMENT_TOKEN
  • Run the application several times and we can see process.env returns the expected values.useRuntimeConfig returns expected values on the first couple of loads but becomes the default empty values after

Describe the bug

useRuntimeConfig returns the environment variables as expected on the initial load but returns empty values for privateRuntimeVariables after loading the page several times.

Additional context

Current working version: 3.0.0-27498038.f18e68b
Latest version: NOT WORKING

Logs

No response

@tuan-bui tuan-bui changed the title Missing useRuntimeConfig on Lambda Missing useRuntimeConfig values on Lambda Feb 13, 2023
@danielroe danielroe mentioned this issue Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant