How pass dynamically aa env value to proxy library on nuxt config #26945
Unanswered
viniciuspinatti
asked this question in
Questions
Replies: 1 comment 3 replies
-
Where does your application get built (GitHub actions, Jenkins, CodePipeline, etc)? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys!
I'm having some issues with a Nuxt 3 application. I'm migrating an app from Nuxt 2 to Nuxt 3 and I had some problems with websocket. But I solved it using the module @nuxt-alt/proxy. My problem is I can't use the env vars NUXT_PUBLIC_BROWSER_BASE_URL and NUXT_PUBLIC_WS_BASE_URL to set the
target
in proxy library config. They only work in runtimeConfig, and the code below doesn't work for proxy configuration when I build to prod (I got an empty value for both targets).But if I change the target to a literal url string (example below), then both start to work.
I cannot use a fixed value. I need to use environment config because I get the values from AWS SSM parameters for each environment (dev, demo, prod) in my AWS container task.
I already tried to use VITE_ vars with
import.meta.env
but it didn't work.I also tried to create a module file to get the values from runtime config (example below).
I didn't have success yet. Then only way that it worked was putting the hard code URL string.
Note: the values are being detected from the environment because I checked that runtimeConfig values are being populated correctly.
I'm open to any solution or idea to avoid put a fixed value there.
Beta Was this translation helpful? Give feedback.
All reactions