Hey all, just wondering how the ENV variables are ...
# help
j
Hey all, just wondering how the ENV variables are being injected in at the start of the StaticSite Builds? It looks like it's not pushing it into
expo build:web
and when I print out the ENV, I just get the following instead of it being filled properly.
Copy code
REACT_APP_COGNITO_USER_POOL_ID: '{{ REACT_APP_COGNITO_USER_POOL_ID }}',
  REACT_APP_AWS_REGION: 'us-west-2',
  REACT_APP_API_ENDPOINT: '{{ REACT_APP_API_ENDPOINT }}',
The defn:
Copy code
new StaticSite(this, 'ClientApp', {
    path: 'frontend/client',
    buildOutput: 'web-build',
    buildCommand: 'npm run build:web',
    errorPage: 'redirect_to_index_page',
    environment: {
      REACT_APP_AWS_REGION: scope.region,
      REACT_APP_COGNITO_USER_POOL_ID: this.auth.userPoolId || '',
      REACT_APP_COGNITO_USER_POOL_CLIENT_ID: this.auth.userPoolClientId || '',
      REACT_APP_API_ENDPOINT: this.api.url,
      REACT_APP_COGNITO_DOMAIN: rootDomain,
    },
  });
f
Hey @justindra, placeholder values (ie.
{{REACT_APP_COGNITO_USER_POOL_ID}}
) are used at build time. And they are replaced with the real value at deploy time (ie. after the user pool is deployed).
Let me know if that makes sense.
j
Ah ok gotcha. I think Expo is treating it a bit differently and is expecting at build time. Let me try adjusting on that side of it.