Closed ronster37 closed 4 months ago
What is your VSCode TypeScript version?
Or try 5.4.5
and see if the bug still exists
@fzn0x I appreciate the prompt response.
It is 5.4.5
unfortunately.
I tried 5.3.3
and 4.9.5
and still seeing the same thing.
If I manually add the export on the CloudFrontResult interface in the node_modules, that seems to resolve the problem though.
Hi @ronster37 !
I've tried it in my environment, but it does not reproduce. I can add export
for CloudFrontResult
, but will it fixed with that change?
diff --git a/src/adapter/lambda-edge/handler.ts b/src/adapter/lambda-edge/handler.ts
index 12e58cc..f7bd52f 100644
--- a/src/adapter/lambda-edge/handler.ts
+++ b/src/adapter/lambda-edge/handler.ts
@@ -85,7 +85,7 @@ export interface Callback {
}
// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses-in-requests.html#lambda-generating-http-responses-programming-model
-interface CloudFrontResult {
+export interface CloudFrontResult {
status: string
statusDescription?: string
headers?:
@yusukebe That's very strange. What version of node are you using? I tried v22 and v18 and still experienced this issue 🤔
@ronster37
Hmm..yes, strage. I think this is not a Node.js matter but a TypeScript problem. Can you try to create the project with the following command again?
npm create hono@latest -- --template lambda-edge
Yes, that worked. The tsconfig.json file differs greatly from the one generated by following the documentation. Because of this, I was able to locate the issue.
Here is the tsconfig.json generated using cdk init app -l typescript
:
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": [
"es2020",
"dom"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"node_modules",
"cdk.out"
]
}
Removing (or setting to false) the declaration
attribute solves the issue. I added "skipLibChecks" and "skipDefaultLibCheck" but it had no effect.
I think removing it might be ok since I will not be building a library.
@ronster37
Thank you for sharing the tsconfig.json
! But it is weird. It does not show the error in my environment with your config.
I think removing it might be ok since I will not be building a library.
Yeah. It may be so.
I'm going to close this out for now.
For anyone else who encounters this remove "declaration": true
fixes this problem.
What version of Hono are you using?
4.3.10
What runtime/platform is your app running on?
Lambda@Edge
What steps can reproduce the bug?
The linter is failing just following the tutorial. It's having an issue with the return type of the handle function (CloudFrontResult).
I think CloudFrontResult may just need to be exported.
What is the expected behavior?
No lint errors from the basic tutorial.
What do you see instead?
Lint error on handle function.
Additional information
No response