imagekit-developer / imagekit-javascript

Javascript SDK for using ImageKit.io
https://imagekit.io
77 stars 26 forks source link

Token not found despite authentication endpoint returning valid object with token, expire and signature values #80

Closed deepkmal closed 1 year ago

deepkmal commented 1 year ago

Technology: JavaScript Next.js

Reproduction of error:

https://codesandbox.io/p/sandbox/vibrant-voice-zpg5dp?file=%2Fapp%2Fpage.tsx%3A9%2C7

Package Versions installed:

imagekit-javascript: ""^2.0.0", imagekit: "^4.1.3", "next": "^13.4.6", "react": "18.2.0",

Summary:

The use case is uploading user profile pictures and listing photos for my marketplace app to the ImageKit CDN. I can generate a signature just fine (a JSON object with token, expire and signature values is returned from my create-signature endpoint/serverless function), so I do not think the issue lies with the "imagekit" Node.js SDK/package. However, when I call the upload() function on an instance of the ImageKit object initialised with the authenticationEndpoint as a property of said object, the following error is thrown:

"Missing token for upload. The SDK expects token, sginature and expire for authentication"

What I think might be happening:

This may be an issue that is a limited to the latest version of this package/SDK. This issue appeared when I updated the imagekit-javascript package to it's latest version. I have not touched any another parts of the code required to upload an image to the ImageKit CDN since initially writing the function.

deepkmal commented 1 year ago

Update It does indeed seem to be a version issue as downgrading to version "^1.5.2" of this package/SDK resolved this issue.

imagekitio commented 1 year ago

Please check changelog https://github.com/imagekit-developer/imagekit-javascript#breaking-changes