nestjs-sqs
nestjs-sqs copied to clipboard
Type Error Cannot read properties of undefined (reading 'meta')
the undefined issue in this library node : v16.19.0 Version: "@ssut/nestjs-sqs": "^2.0.0", OS: Windows 11 aws-sdk version: "2.1388.0"
"errorMessage": "Cannot read properties of undefined (reading 'meta')",
"errorType": "TypeError",
"stackTrace": [
"TypeError: Cannot read properties of undefined (reading 'meta')",
" at node_modules\\@ssut\\nestjs-sqs\\dist\\sqs.service.js:64:49",
" at Array.forEach (<anonymous>)",
" at SqsService.<anonymous> (\\node_modules\\@ssut\\nestjs-sqs\\dist\\sqs.service.js:55:83)",
" at Generator.next (<anonymous>)",
" at fulfilled (\\node_modules\\@ssut\\nestjs-sqs\\dist\\sqs.service.js:17:58)",
" at processTicksAndRejections (node:internal/process/task_queues:96:5)"
]
}
I'm also facing the same issue it's still working in my project with previous files but after removing the node_modules when I install it gives me this error
I had the same issue here.
My issue was that my consumer (class with @SqsMessageHandler) was not defined/registered in the module 😢
I hope it helps others.
I had the same issue here. My issue was that my consumer (class with
@SqsMessageHandler) was not defined/registered in the module 😢 I hope it helps others.
Thanks man. It works. maybe the dude forgot to catch exception.
Had this issue today too. After some debugging, found the root cause of the issue is if you pass a queue configuration to the module when there's no handler configured, it will error out, because of a missing return in this guard condition: https://github.com/ssut/nestjs-sqs/blob/master/lib/sqs.service.ts#L39
it is because your @SqsMessageHandler('QUEUE_NAME', true) is not registered
also when i want to pass an env var to the SqsMessageHandler method decorator, when i pass the hardcoded queue name, everything is fine, but process.env.QUEUE_NAME won't work, don't sure why though
@toufikat it is because how SqsMessageHandler method decorator work, please refer to my solution if you want dynamic queue name in decorator https://github.com/ssut/nestjs-sqs/issues/8#issuecomment-1842631842
make sure that you user dotenv.config() in the file where you are using process.env.QUEUE_NAME had the same issue, on the local machine it worked without dotenv.config(), but on the server it doesn't