Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate sts + ipfs worker to next api #4017

Merged
merged 2 commits into from Nov 16, 2023
Merged

feat: migrate sts + ipfs worker to next api #4017

merged 2 commits into from Nov 16, 2023

Conversation

bigint
Copy link
Member

@bigint bigint commented Nov 16, 2023

  • feat: migrate sts + ipfs worker to next api
  • feat: migrate sts + ipfs worker to next api

What does this PR do?

🤖[deprecated] Generated by Copilot at 9a229ab

This pull request migrates the STS token generation and IPFS pinning logic from Cloudflare workers to Next.js API routes. It updates the dependencies, environment variables, constants, and URLs to reflect this change. It also deletes the unused worker packages and files.

Related issues

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking small changes to existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Explanation of the changes

🤖[deprecated] Generated by Copilot at 9a229ab

  • Move the STS service from a Cloudflare worker to a Next.js API route (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Rename the file packages/workers/sts/src/handlers/getStsToken.ts to apps/api/pages/api/sts/token.ts and update the imports accordingly (link)
  • Update the way the environment variables are accessed using the process.env object and cast them as strings (link)
  • Update the way the response is sent using the res.status().json() method (link)
  • Add the allowCors middleware to enable CORS for the API endpoint (link)
  • Update the import of the STS_GENERATOR_WORKER_URL constant to use the HEY_API_URL constant instead in the apps/web/src/lib/uploadToIPFS.ts file (link)
  • Update the URL for fetching the STS token to use the API route URL in the getS3Client function (link)
  • Remove the entry for the STS token generator worker from the docs/ports.md file (link)
  • Remove the definition of the STS_GENERATOR_WORKER_URL constant from the packages/data/constants.ts file (link)
  • Remove the entry for the packages/workers/sts package from the pnpm-lock.yaml file (link)
  • Delete the files related to the packages/workers/sts package (link, link, link, link, link, link, link, link, link, link)
  • Add a new API route for pinning IPFS files using the IPFS Lens service (link, link, link)
    • Add a new file apps/api/pages/api/ipfs/pin.ts which defines a handler for the /ipfs/pin API endpoint (link)
    • Update the URL for pinning the IPFS file to use the API route URL in the uploadToIPFS function (link)
    • Remove the entry for the packages/workers/pro package from the pnpm-lock.yaml file (link)
  • Add the @aws-sdk/client-sts dependency to the apps/api/package.json and pnpm-lock.yaml files (link, link)
  • Add three environment variables to the apps/api/.env.example file for the Ever and IPFS services (link)

Emoji

📁📌🚀

Copy link

vercel bot commented Nov 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
api ✅ Ready (Inspect) Visit Preview Nov 16, 2023 6:12pm
prerender ✅ Ready (Inspect) Visit Preview Nov 16, 2023 6:12pm
web ✅ Ready (Inspect) Visit Preview Nov 16, 2023 6:12pm

Copy link

height bot commented Nov 16, 2023

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@bigint bigint merged commit 77b1345 into main Nov 16, 2023
5 of 9 checks passed
deepsource-autofix bot added a commit that referenced this pull request Nov 16, 2023
This commit fixes the style issues introduced in 9a229ab according to the output
from Prettier.

Details: #4017
@vercel vercel bot temporarily deployed to Preview – prerender November 16, 2023 18:08 Inactive
@vercel vercel bot temporarily deployed to Preview – api November 16, 2023 18:08 Inactive
Comment on lines +13 to +22
const ipfsResponse = await fetch(
`https://cl-api.ipfs-lens.dev/pins/${cid}`,
{
method: 'POST',
headers: {
Authorization: `Basic ${process.env.LENS_IPFS_AUTH_KEY}`,
'X-App': 'hey.xyz'
}
}
);

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant