Open C4n4rd0 opened 1 year ago
thank you for creating this issue @C4n4rd0 unfortunately v8.8.1
is not maintained anymore. do you know if your issue applies to the latest version which currently is v12.0.3 as well? if that's the case, could you create a small repro repository which outlines your issue? labeling as bug in the meanwhile.
Yes the issue applies to the lastedt version. The proposed solution is based on the latest code base. I'll add a repo allowing to reproduce the issue in few days.
As requested, here is a repro repository with the last serverless offline version: https://github.com/C4n4rd0/bug-sls-offline-1631
I'm experiencing this issue too - is there any workaround?
Current Behavior
In a step function, with retriers defined, orchestrating typescript lambdas, if the lambda throws a custom exception, the retrier does not work because serverless-offline changes the errorType to "Error" instead of populating the value of err.name. The result is that the lambda is executed only once and it fails.
Here is the log output:
[Serverless Step Functions Local] 2022-12-16 17:41:19.675: arn:aws:states:...:my-lambda:... : {"Type":"TaskFailed","PreviousEventId":18,"TaskFailedEventDetails":{"ResourceType":"lambda","Resource":"invoke","Error":"Error","Cause":"{\"errorType\":\"Error\",\"errorMessage\":\"INFO: Lambda is initializing your function. It will be ready to invoke shortly.\",
Sample Code
abstract class MockAWSException extends Error implements AWSError { readonly code: string; readonly retryable?: boolean | undefined; readonly statusCode?: number | undefined; readonly time: Date; readonly requestId?: string | undefined; protected constructor( readonly message: string, { retryable, statusCode, }: { retryable?: boolean | undefined; statusCode?: number | undefined; }, ) { super(message); this.code = this.constructor.name; this.name = this.constructor.name; this.time = new Date(); this.requestId = uuid(); this.statusCode = statusCode; this.retryable = retryable; Error.captureStackTrace(this, this.constructor); } }
export class CodeArtifactUserPendingException extends MockAWSException { constructor(readonly message: string) { super(message, { statusCode: 500, retryable: true, }); } }