Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics.d.ts should not include function interfaces declared as 'async' #499

Closed
rpfeil opened this issue Sep 15, 2023 · 7 comments
Closed
Labels
bug Something isn't working discussion Question or issue being discussed fixed Issue has been fixed in the repo

Comments

@rpfeil
Copy link

rpfeil commented Sep 15, 2023

ISSUES will not receive priority that do not complete this template. They will be flagged as "Insufficient Information" and may be closed without any action.

Describe the bug

I am installing OneTable into an AWS Lambda function project generated by SAM. Compilation complains about the async references in the Metrics.d.ts file. 'error TS1040: 'async' modifier cannot be used in an ambient context'. Editing the file directly, and removing all the asyncs, makes everything work. This kills deployment though.

https://stackoverflow.com/questions/48448151/how-can-i-add-an-async-function-to-a-type-def-file

I'm sorry there is no proper repro. I've been trying for 7 days to get OneTable to work. I don't have any more time for this. I'd rather just remove it.

package.json
{
"name": "hello_world",
"version": "1.0.0",
"description": "Gaylord Claims API Lambda",
"main": "app.js",
"repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs",
"author": "SAM CLI",
"license": "MIT",
"dependencies": {
"aws-sdk": "^2.1458.0",
"axios": ">=0.21.1",
"dynamodb-onetable": "^2.7.0"
},
"scripts": {
"build": "tsc",
"clean": "rm -rf build"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.119",
"@types/node": "^20.6.0",
"chai": "^4.3.6",
"mocha": "^10.1.0",
"typescript": "^5.2.2"
}
}

Sincerely,
Rick Pfeil - rpfeil@gmail.com

@mobsense
Copy link
Contributor

Hi, thanks for your comment.

What do you mean "kills deployment though"?

I can understand removing async, as the return type is Promise<>. Does just removing async work?

Michael

@rpfeil
Copy link
Author

rpfeil commented Sep 15, 2023

Yes, it does work :-). It kills deployment because I can't include my changes. It pulls fresh code from npm.

@mobsense
Copy link
Contributor

Okay, understand. We'll push out a fix today.

@mobsense mobsense added the bug Something isn't working label Sep 15, 2023
@rpfeil
Copy link
Author

rpfeil commented Sep 15, 2023

I super appreciate this! I love what this package does :-). But I made the mistake of trying to run it client side first.

@mobsense mobsense added discussion Question or issue being discussed and removed bug Something isn't working labels Sep 15, 2023
@mobsense
Copy link
Contributor

Thank you. Why was client side a mistake? We do that in one of our apps.

@rpfeil
Copy link
Author

rpfeil commented Sep 15, 2023

How?!?! The Node.js modules (crypto, process, ect) are no longer provided for clients. I couldn't get any polyfill to work.

@mobsense
Copy link
Contributor

SenseDeep uses the AWS SDK in the client and OneTable. We use some 3rd party polyfills and we created the others.

@mobsense mobsense added bug Something isn't working fixed Issue has been fixed in the repo labels Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion Question or issue being discussed fixed Issue has been fixed in the repo
Projects
None yet
Development

No branches or pull requests

2 participants