imagekit-developer / imagekit-nodejs

Node.js SDK for ImageKit.io API.
https://imagekit.io
Other
84 stars 32 forks source link

renameFile attempt gets 'Invalid CSRF Token' #73

Closed CamTheGoblin closed 1 year ago

CamTheGoblin commented 1 year ago

I am attempting to rename a file , pretty much following along with the example in the documentation. but it is getting an Error response: { error: 'Invalid CSRF Token' }

here is how I have the code set up:

await imagekit.renameFile({
    filePath: oldFilePath,
    newFileName: "newImageName.jpg",
    purgeCache: false,
})

Just before this I am retrieving the oldFilePath value via a imagekit.getFileDetails call:

const { filePath:oldFilePath } = await imagekit.getFileDetails(fileID)

and that is correctly giving me the file path, so the ImageKit instance appears to be set up correctly, its just the renameFile that is failing on me. I am running the in a NextJS application as a localhost server in case that makes a difference. I am not familiar with CSRF Tokens, is there something I have to change to get the tokens to validate correctly?

imagekitio commented 1 year ago

Can you please share the x-request-id https://github.com/imagekit-developer/imagekit-nodejs#access-request-id-other-response-headers-and-http-status-code?

CamTheGoblin commented 1 year ago

'x-request-id': '9e42a9fa-282d-4380-a8c6-88241ae646cf'

gary-dev-aus commented 1 year ago

Hi, I was wondering if there was any update on this? I'm getting the same problem.

imagekitio commented 1 year ago

Please provide the minimum code to reproduce this problem and reopen this issue.

imagekitio commented 11 months ago

Fixed in version 4.1.4