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

API integration not working (CORS issue?) #1671

Open
1 task done
danpreiss opened this issue Dec 18, 2024 · 1 comment
Open
1 task done

API integration not working (CORS issue?) #1671

danpreiss opened this issue Dec 18, 2024 · 1 comment

Comments

@danpreiss
Copy link

Describe the bug

I have spent the better part of two days and millions of tokens trying to resolve this issue. I noticed today that a new feature was released around Request Relay that I would think have solved this issue for me but alas no success. I am trying to implement this API, which works when I run in the console but continue to receive errors when I have Bolt implement in the react app. I've even tried corsproxy.io.

https://supadata.ai/en/documentation/youtube/get-transcript

Link to the blitz that caused the error

https://bolt.new/~/sb1-p8cny9tv

Steps to reproduce

  1. Go to Tester in the left nav
  2. Click run test
  3. View console

Note: I did not try locally but this seems like a webcontainer issue

Expected behavior

Should fetch the youtube transcript

Parity with Local

Screenshots

image

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

@danpreiss
Copy link
Author

Issue Analysis Report

Current Behavior

  1. The transcript fetching functionality is failing silently with an empty error object
  2. The Vite proxy configuration is not effectively handling the requests
  3. Network requests are not visible in browser dev tools
  4. The error appears to be happening at the initial fetch attempt

What Has Been Tried

  1. Direct API calls to Supadata (failed due to CORS)
  2. CORS proxy through corsproxy.io (removed)
  3. Vite proxy configuration attempting to forward requests
  4. Multiple retry mechanisms in the fetch logic

Technical Investigation

  1. Request Flow
  2. Client makes request to /api/transcript
  3. Vite proxy should intercept and forward to Supadata
  4. Response should come back through proxy
  5. Client code handles response/errors

Key Issues Identified
The Vite proxy configuration may not be loading correctly because:

  • Config imports may be circular or failing
  • Environment variables might not be available during proxy setup
  • Proxy headers might not be properly forwarded

Error handling is losing information because:

  • Empty error objects in catch blocks
  • Multiple layers of error transformation
  • Async stack traces being lost

Network isolation in WebContainer:

  • Limited network access
  • Proxy needs special configuration for WebContainer environment
  • CORS headers may be stripped

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

No branches or pull requests

1 participant