Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
Can't pull sqs queue name from .env file in nestjs

When pulling the queue name through .env file I get the following error on the console: Cannot read properties of undefined (reading 'meta').

How can I pass queue name from .env file to nestjs @SqsMessageHandler decorator?. I am using @ssut/nestjs-sqs library.

 @SqsMessageHandler(process.env.QUEUE_NAME, false)
       public async handleMessage(message: AWS.SQS.Message) {
        console.log(message);
       }
    
       @SqsConsumerEventHandler(process.env.QUEUE_NAME,'processing_error',
       )
       public onProcessingError(error: Error, message: AWS.SQS.Message) {
        // report errors here
        console.error(error);
        console.error(message);
    }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The problem is that the process.env.QUEUE_NAME is not available at the time you're using it. You'll need invoke dotenv (or whatever package that read & parse the env file) by yourself if you want to use process.env. like this.

about 4 years ago · Juan Pablo Isaza Report

0

imports: [
    ...
    ConfigModule.forRoot({
      envFilePath: '.env',
    }),
  ],

You can add env file import like this in your Sqs module, which is the standard way of using .env files in a NestJS module.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!