question: ServiceNotFound Error in typedi 0.10 (it worked in 0.8.x)
See original GitHub issueHi,
I have a problem with tests and new version of typedi. I have an service:
@Service()
export class S3Service {
@Inject()
private s3: S3;
and I want test this service. In previous version 0.8 I had working test defined like that:
describe('S3Service', () => {
let s3Params: any;
let s3: S3;
let s3Service: S3Service;
beforeEach(() => {
s3 = Container.get(S3);
s3Service = Container.get(S3Service);
});
afterEach(() => {
Container.reset();
});
[... tests definitions here ]
Now, in the 0.10 version I see that kind of error:
ServiceNotFoundError: Service with "<UNKNOWN_IDENTIFIER>" identifier was not found in the container. Register it before usage via explicitly calling the "Container.set" function or using the "@Service()" decorator.
Can someone point me what changed in the 0.10 that caused this problem?
Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
cannot upgrade to 0.10.0 due to @Service() being mandatory ...
Is there any reason why we don't allow like in 0.8.0 ability to instantiate a class without the @Service part? Yes, because attempting...
Read more >reactjs - TypeDI: class in injected service is not a function or ...
EDIT: Just tried the sample code from the TypeDI page and I'm getting the same exact error: serviceInstance.injectedService.printMessage is not ...
Read more >typedi - npm
TypeDI is a dependency injection tool for TypeScript and JavaScript. With it you can build well-structured and easily testable applications in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You have to register it first in the container:
The
@Servicedecorator register your class (S3Service) in the container, not the S3 class from the AWS SDK.This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.