Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Error Cannot read properties of undefined (reading 'meta') #51

Open
manojpawarsj12 opened this issue Jun 2, 2023 · 8 comments
Open

Comments

@manojpawarsj12
Copy link

manojpawarsj12 commented Jun 2, 2023

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)"
    ]
}
@ziasultan2
Copy link

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

@adamatti
Copy link

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.

@tombroskipc
Copy link

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.

@workmad3
Copy link
Contributor

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

@SK-CSE
Copy link

SK-CSE commented Dec 6, 2023

it is because your @SqsMessageHandler('QUEUE_NAME', true) is not registered

@toufikat
Copy link

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

@SK-CSE
Copy link

SK-CSE commented Dec 15, 2023

@toufikat it is because how SqsMessageHandler method decorator work, please refer to my solution if you want dynamic queue name in decorator
#8 (comment)

@Fsociety-sem
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants