Comments (12)
@nicholasgriffintn Your canary version worked for us.
We attempted to update from v9.x
to v10.1.0
and were getting the following error:
error TS2307: Cannot find module 'sqs-consumer' or its corresponding type declarations.
There are types at '[redacted]/sqs-consumer/dist/types/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
Using 10.2.0-canary.0
, the error is gone and the project builds correctly.
from sqs-consumer.
Awesome, I've released it now as 10.2.0. Will leave this open in case it didn't fix it, and will close later if it did.
from sqs-consumer.
Update: I've published 10.2.1
just now, that exports type files specific for esm and cjs, ran it through this, seems to be happy: https://arethetypeswrong.github.io/?p=sqs-consumer
Maybe that version might fix the issue for you?
from sqs-consumer.
@nicholasgriffintn And I just noticed your comment about 10.2.1
, so yep! You were right on it. Thanks again!
from sqs-consumer.
Yup, this breaks for CommonJS import resolution:
Error: test/publishers/SnsPermissionPublisher.spec.ts(7,26): error TS2307: Cannot find module 'sqs-consumer' or its corresponding type declarations.
There are types at '/home/runner/work/message-queue-toolkit/message-queue-toolkit/node_modules/sqs-consumer/dist/types/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
Error: ../sqs/lib/sqs/AbstractSqsConsumer.ts(19,26): error TS2307: Cannot find module 'sqs-consumer' or its corresponding type declarations.
There are types at '/home/runner/work/message-queue-toolkit/message-queue-toolkit/node_modules/sqs-consumer/dist/types/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
Looks like dual-publishing is not setup correctly.
from sqs-consumer.
Yup, we seem to have some sort of issue going on, one that is on the list to try to figure out when I have the time, for now, it's probably best to stick to v9 if you are getting these errors, in my testing, it did load for common js, but it seems I didn't hit every use case.
I'm not sure how to do that / if that's actually possible.
One avenue may be that we need to add main
and types
back to the package json, I'm still researching though.
from sqs-consumer.
I have published a canary version: [email protected]
that adds main
and types
back, I hoping this is solution, not fully tested yet though as it is a bit late and back to the day job tomorrow, would be great if people could try it and let us know if it does the job or not.
from sqs-consumer.
@nicholasgriffintn Thank you, it works now!
from sqs-consumer.
@nicholasgriffintn 10.2.0
works for an old project (hooray!), but when I use it in a project with a more recent tsconfig, it breaks that project (oh no!).
10.1.0
fails but 10.2.0
works with the error I mentioned above when we had these compilerOptions
set:
{
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": false,
},
"exclude": ["node_modules", "dist"]
}
However, in another project with the following tsconfig settings, 10.1.0
works but now 10.2.0
breaks:
{
"compilerOptions": {
"target": "es2022",
"module": "Node16",
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": false,
},
"exclude": ["node_modules", "dist"]
}
The error we get with 10.2.0
for the above tsconfig:
error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("sqs-consumer")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `"type": "module"` to '[redacted]/package.json'.
import { Consumer } from 'sqs-consumer';
Sorry, I know this must be a pain! There might be settings we can change to try to rectify it, but this isn't an issue we have with the other libs we import, so I'm guessing it won't just be me.
from sqs-consumer.
@trevor-brandt Sorry, not sure I'm able to replicate, we have a few examples going here, they all seem to be loading up as expected:
https://github.com/bbc/sqs-consumer-starter/tree/main/examples
Would you mind forking and providing an example according to the closest one to your setup please? This is one I've setup using your tsconfig: https://github.com/bbc/sqs-consumer-starter/tree/main/examples/ts-commonjs-node16
from sqs-consumer.
@nicholasgriffintn , I started taking a look at your starter example and couldn't repro until I noticed you're using 10.2.1
. If I bump my patch version from 10.2.0
to 10.2.1
everything is great!
I'm able to repro with a couple changes to your ts-commonjs-node16 if I revert to 10.2.0
(we're using import
instead of require
in our code), but since the latest is working for me, I'm good if you're good.
Thanks for all your efforts to get this stuff ironed out!
from sqs-consumer.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
from sqs-consumer.
Related Issues (20)
- [Bug]: Undocumented breaking change - acknowledgment to handleMessage HOT 7
- v5.8.0 if send message to sqs queue on other pc HOT 2
- [Bug]: ApproximateReceiveCount is not part of QueueAttributeName HOT 4
- The automated release is failing 🚨 HOT 1
- [Bug]: Version 8.1.5 of this library incompatible with @aws-sdk/client-sqs version 3.507.0 HOT 5
- Add a link to the docs at the top of the readme HOT 2
- Remove AWS SDK V2 Note
- Upgrade p-event to v6 HOT 1
- Upgrade chai to v5 HOT 1
- Remove the `handler_processing` debugger HOT 2
- [Bug]: CredentialsProviderError is not treated as a connection error HOT 2
- [Bug]: SQS receive message failed: connect ETIMEDOUT <ip>:443 every few hours HOT 4
- [Bug]: When consumer fails to react to SQS instant retry occurs HOT 3
- [Bug]: attributeNames does not support MessageSystemAttributeName HOT 3
- The automated release is failing 🚨 HOT 1
- [Bug]: When consumer fails to connect to SQS due to connectivity instant retry occurs HOT 2
- [Feature Request]: Enhance SQSError with AWS error $response object for Better Debugging HOT 5
- [Bug]: `MaxListenersExceededWarning` when using newer AWS SDK version HOT 22
- [Chore]: Update aws sdk to the latest version HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqs-consumer.