Skip to content

Bug: unable to build with tsc when not using @middy/core #1068

Closed
@rreddypally

Description

@rreddypally

Bug description

EDIT: see this comment for updated info after triage.


The import statement in Tracer.ts for TracerInterface is importing all the modules from the root. https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/packages/tracer/src/Tracer.ts#L3.

I am trying to use tracer module without the need to install middy.

Expected Behavior

Should be able to use Tracer without the need to import middy when its not used.

Current Behavior

This behavior is forcing to import middy middleware

Possible Solution

import { TracerInterface } from './TracerInterface';

Steps to Reproduce

  1. Install tracer npm module npm i @aws-lambda-powertools/tracer
  2. Import tracer import { Tracer } from "@aws-lambda-powertools/tracer/lib/Tracer";
  3. Add tracer annotation and build fails with error TS2307: Cannot find module '@middy/core' or its corresponding type declarations.

Environment

  • Powertools version used: 1.1.1
  • Packaging format (Layers, npm): npm
  • AWS Lambda function runtime: Node 16

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompletedThis item is complete and has been merged/shippedtracerThis item relates to the Tracer Utility

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions