async-labs / saas

Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
https://saas-app.async-await.com
MIT License
4.06k stars 675 forks source link

CORS issue for uploading image to Post in demo app #135

Closed klyburke closed 3 years ago

klyburke commented 3 years ago

@tima101 Noting to ourselves that in the current demo app, a user is unable to add an image to a Post due to a CORS problem.

Access to fetch at 'https://saas-api.builderbook.org/api/v1/team-member/aws/get-signed-request-for-upload-to-s3' from origin 'https://saas-app.builderbook.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Screen Shot 2020-11-30 at 4 46 47 AM


Click to see Hill for issue #135
  <div><img src="https://async-github-hills.s3.amazonaws.com/async-labs-saas/135.png" alt="Single issue hill" class="s3-image" width="100%" /></div></details>
  <details><summary>Click to see <b>Hill for all issues </b></summary><div>
  <img src="https://async-github-hills.s3.amazonaws.com/async-labs-saas/all-issue-hill.png" alt="All issue hill" class="s3-image" width="100%" /></div></details>

created by Async

tima101 commented 3 years ago

@klyburke Image upload works on YourSettings page, meaning it is not S3 problem and not cors Express middleware problem, must be problem in Post-related code. I will report here when I find out.

tima101 commented 3 years ago

@klyburke Pushed fix https://github.com/async-labs/saas/commit/83fa735034672ddabff46875c358d7c06106ac5c https://github.com/async-labs/saas/commit/f4c89cb6f0b676b79f659dd19142e0fde1b78ac2

One of env var was not available on the browser. Let's keep it open until I make fix in the book's content.

tima101 commented 3 years ago

@klyburke Solved.

klyburke commented 3 years ago

I confirm that image upload in a Post is working now. Thanks!