VACOTechSprint / ambient-transcription

Docs and management tasks for sprint
1 stars 0 forks source link

Generate Signed URLs on the Server #11

Closed dahifi closed 8 months ago

dahifi commented 8 months ago

Create a system that uploads files to a Google Cloud Storage bucket via a web front-end application. To secure this process, you're planning to use signed URLs which are generated by a server-side component. Here's a breakdown of the requirements and steps based on the provided information:

Create Serverless Function: Deploy via Terraform a simple Node.js cloud function (Google Cloud Functions) that returns "Hello World". This function will eventually generate signed URLs for secure file uploads. Security: For the demo, there will be no identity federation, but there's an intention to add some level of authentication: The function should not be publicly accessible. Implement basic security by requiring a bearer token to call the function. Front-end Component: Develop a React component that can call the cloud function in an authenticated manner using Axios HTTP client. This component will initially just test if it can successfully receive "Hello World" from the backend. Later, it will be adapted to retrieve signed URLs. Generate Signed URL: Create another cloud function or modify the existing one to generate signed URLs for uploading files to Google Cloud Storage bucket. File Upload Process: The React component will receive the signed URL from the cloud function. Use this URL for securely uploading files directly from the client-side application to Google Cloud Storage.

dahifi commented 8 months ago

The cloud function has been deployed as part of the https://github.com/VACOTechSprint/project-management/tree/ambient-recording branch. cloud_functions/index.js exports.generateSignedUrl

Functionality has been added to the frontend/src/components/AudioUploader.jsx const fetchSignedUrl, but we haven't been able to validate the URL is correct.

dahifi commented 8 months ago

Success! aa4f235a013a91cf49f76825ce8dbaf0ff18f492