Probably just me being stupid, but I'm unable to g...
# help
s
Probably just me being stupid, but I'm unable to get the bucketName in my api endpoint handlers as an environment variable
Copy code
const bucket = new Bucket(stack, 'translation', {
    removalPolicy: stack.stage === 'dev' ? RemovalPolicy.DESTROY : RemovalPolicy.RETAIN
  });

  const api = new Api(stack, 'api', {
    routes: {
      'GET /healthcheck': 'functions/lambda.healthcheck',
      'POST /notification': 'functions/lambda.notification'
    },
    // I WOULD IMAGINE THE SAME enviroment property could go here
    // BUT IT DOESN'T ALLOW IT (doesn't exist) and the two endpoints using
    // process.env.TRANSLATION_BUCKET_NAME returns undefined.
  });

  const translations = new Function(stack, 'download-translations', {
    handler: 'functions/translations.download',
    environment: {
      TRANSLATION_BUCKET_NAME: bucket.bucketName // THIS SECTION WORKS FOR THIS FUNCTION, but doesn't work on the API enpoints
    }
  });
Can someone spot my mistake?
Oh, nevermind. for the api one, it's
Copy code
defaults: {
  function {
    environment: {
     // env goes here.
} } }
Just needed to ask out loud xD