Amplify Storage and NextJS Sever Actions #7801
fraubungle
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I hope that someone here can help me with some clarification or help regarding the Amplify Storage and NextJS Server Actions.
We are using "getCurrentUser" to get the user data and we use "generateServerClientUsingCookies" to fetch and update amplify data.
but I we also want to upload/update data to the storage via the server but I cant find any documentation on how to achieve this. I am looking at this portion of the page #supported-apis-for-nextjs-server-side-usage where it shows the supported api's and under storage there are only functions for fetching data and nothing to do with adding anything.
Am i just missing something obvious or is this just not available to do via the server and I have to do it via the client which we would have to modify or flow to make this work.
Here is an example of how we are trying to upload a file via the server
**_...
const { userId } = await AuthGetCurrentUserServer();
....
const audioStream = await response.blob();
const filename =
media/${userId}/${projectId}/${uuidv4()}.mp3
;const uploadResponse = await uploadData({
path: filename,
data: audioStream,
options: { contentType: 'audio/mpeg' },
}).result;_**
and here is the error we are getting
NoIdentityId: Missing identity ID when accessing objects in protected or private access level.
Beta Was this translation helpful? Give feedback.
All reactions