Closed pinarruiz closed 1 year ago
Hi @pinarruiz ,
What version of typescript are you running?
I'm able to run CreateInvalidation successfully:
import { CloudFrontClient, CreateInvalidationCommand } from "@aws-sdk/client-cloudfront";
const client = new CloudFrontClient("us-east-1");
async function run(){
try {
const res= await client.send(new CreateInvalidationCommand({
DistributionId: "REDACTED",
InvalidationBatch: {
CallerReference: `${Date.now()}`,
Paths: {
Quantity: 1,
Items: ["/"]
},
},
}))
console.log(res)
} catch (error) {
console.log(error)
}
}
run()
$ npm list
4042-cloudfront-invalidatecache@1.0.0 /Users/rvaknin/test_folder/4042-cloudfront-invalidatecache
├── @aws-sdk/client-cloudfront@3.414.0
$ tsc --version
Version 5.0.4
Thanks, Ran~
Hey @RanVaknin,
I am using version 5.2.2
.
Thanks ;) Alex
Hi @pinarruiz ,
Is this a new project you are starting or did you start seeing this after upgrading? The error "Property 'middlewareStack' is missing in type 'CreateInvalidationCommand' but required in type 'Command... " might be related to us moving some packages from '@aws-sdk/' to '@smithy/'.
Please try deleting your node_modules
and package-lock.json
and then running npm install
.
If that doesn't work can you please share your tsconfig file here and the contents of npm ls
?
Thanks, Ran~
Hi @RanVaknin
Is this a new project you are starting or did you start seeing this after upgrading?
It is an upgrade, its a nextjs project and this function runs on an api route, the error is thrown on build time (And also in the editor itself).
Please try deleting your node_modules and package-lock.json and then running npm install.
Just done that (using yarn tho), and noticed that there was a new version of the package (3.418.0
), my issue is solved. Just for the sake of it I tried using 3.414.0
, while removing node_modules
and the yarn.lock
and it worked too.
I am closing the issue on this comment. Thanks for everything. :smile:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
I have the following code:
The code is an adapted copy of the example found at the docs: CreateInvalidationCommand.
With this I get this error:
SDK version number
@aws-sdk/client-cloudfront@3.414.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v16.15.1
Reproduction Steps
Using
@aws-sdk/client-cloudfront@3.414.0
.Observed Behavior
Expected Behavior
The invalidation gets done.
Possible Solution
No response
Additional Information/Context
This same code is working on version:
3.410.0
and it stopped working when upgraded package to version3.414.0
.The code is an adapted copy of the example found at the docs: CreateInvalidationCommand.