Closed govind-amt closed 1 year ago
Make a constants file and import at the top dotenv. It's the only way that worked for me
require('dotenv').config();
export const NEED_QUEUE_URL_FROM_ENV_HERE = process.env. NEED_QUEUE_URL_FROM_ENV_HERE
@ssut Can you please create a hint in the readme for that ? after loading it directly from a constant it worked
`import { Injectable } from '@nestjs/common'; import { SqsMessageHandler } from '@ssut/nestjs-sqs'; import * as AWS from 'aws-sdk'; import { ConfigService } from '@nestjs/config';
@Injectable() export class AwsQueueConsumerService { constructor( private configService: ConfigService ) {} @SqsMessageHandler(NEED_QUEUE_URL_FROM_ENV_HERE, false) async handleMessage(message: AWS.SQS.Message) { //Handle message here } }`
Can Someone please help me to resolve this issue? It's working fine when we hardcode the queue URL there. But its not possible to hardcode in a different environment.