mgp25
mgp25
WWasp
Created by mgp25 on 11/28/2024 in #đŸ™‹questions
CORS Issue
Sure
12 replies
WWasp
Created by mgp25 on 11/28/2024 in #đŸ™‹questions
CORS Issue
Actually, it was a fault on my end, with NGINX config.
tail -n 50 /var/log/nginx/error.log
tail -n 50 /var/log/nginx/error.log
Revealed a misconfiguration caused by certbot applying certain configs on its own. I apologise for this but hopefully this helps out for other users facing similar issues. Thank you!
12 replies
WWasp
Created by mgp25 on 11/28/2024 in #đŸ™‹questions
CORS Issue
Hey @Filip ! Yes, I have deployed it on a VPS under a domain, I dont mind sharing the access via DM XMLHttpRequest is shown in the web console (browser). So frontend not able to communicate to backend because of cors. As per the headers returns when a curl is made to the backend:
* Request completely sent off
< HTTP/2 403
< date: Thu, 28 Nov 2024 17:03:23 GMT
< content-type: text/html
< cf-cache-status: DYNAMIC
< vary: accept-encoding
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=fAl%2B7QyDdr%2B2zdG%2F0Cr9thKUS%2FvEpjoBaqjEJZGw2WDy7%2BcT4Owsg7hGJNC66X9ac%2FGK%2B3JZlQxBvm0w447yRPsrOrD%2FcMGj0kf24eeoP6xzgcJ6Y324sfmNHUozgC6xN1s%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 8e9bee5d7c09cbb6-MAD
< alt-svc: h3=":443"; ma=86400
< server-timing: cfL4;desc="?proto=TCP&rtt=46918&min_rtt=41851&rtt_var=12898&sent=9&recv=12&lost=0&retrans=0&sent_bytes=2927&recv_bytes=584&delivery_rate=67212&cwnd=249&unsent_bytes=0&cid=97a920645e318a91&ts=211&x=0"
<
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
* Connection #0 to host api.mydomain.com left intact
* Request completely sent off
< HTTP/2 403
< date: Thu, 28 Nov 2024 17:03:23 GMT
< content-type: text/html
< cf-cache-status: DYNAMIC
< vary: accept-encoding
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=fAl%2B7QyDdr%2B2zdG%2F0Cr9thKUS%2FvEpjoBaqjEJZGw2WDy7%2BcT4Owsg7hGJNC66X9ac%2FGK%2B3JZlQxBvm0w447yRPsrOrD%2FcMGj0kf24eeoP6xzgcJ6Y324sfmNHUozgC6xN1s%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 8e9bee5d7c09cbb6-MAD
< alt-svc: h3=":443"; ma=86400
< server-timing: cfL4;desc="?proto=TCP&rtt=46918&min_rtt=41851&rtt_var=12898&sent=9&recv=12&lost=0&retrans=0&sent_bytes=2927&recv_bytes=584&delivery_rate=67212&cwnd=249&unsent_bytes=0&cid=97a920645e318a91&ts=211&x=0"
<
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
* Connection #0 to host api.mydomain.com left intact
12 replies
WWasp
Created by mgp25 on 11/21/2024 in #đŸ™‹questions
Question about shared constants
I am using wasp 0.13.0 but maybe I missed that step. Once I have everything working on my end will be migrating to the most recent wasp release. I have develop some software in the past and sometimes backward breaks are inevitable in order to make the code better/more efficient. Keep up the good work! đŸ™‚
21 replies
WWasp
Created by mgp25 on 11/21/2024 in #đŸ™‹questions
Question about shared constants
I thought about 1. as well, but I wasnt sure which would be the best to have things organised. As per 2. I was about to ask how to do it, but just saw your edit, and making a query is also a suitable option. Will think about these Thank you for your response!
21 replies
WWasp
Created by mgp25 on 11/21/2024 in #đŸ™‹questions
Question about shared constants
I did! I had to do some tweaking and also realised one thing along the way. 1. I had to create vite-env.d.ts which should has this inside:
/// <reference types="vite/client" />
/// <reference types="vite/client" />
2. /shared/constants.ts is a file that is run both in Client and server side, which means import.meta.env. wont work in server side, causing it to crash. So you end having two possible alternatives, either using a specific client side constants file, or just edit the shared constants to make sure is not run in server:
export const STRIPE_CUSTOMER_PORTAL_LINK = typeof window !== 'undefined'
? import.meta.env.REACT_APP_STRIPE_CUSTOMER_PORTAL_LINK
: undefined;
export const STRIPE_CUSTOMER_PORTAL_LINK = typeof window !== 'undefined'
? import.meta.env.REACT_APP_STRIPE_CUSTOMER_PORTAL_LINK
: undefined;
21 replies
WWasp
Created by mgp25 on 11/21/2024 in #đŸ™‹questions
Question about shared constants
I am doing @kapa.ai :
export const STRIPE_CUSTOMER_PORTAL_LINK = import.meta.env.REACT_APP_STRIPE_CUSTOMER_PORTAL_LINK;
export const STRIPE_CUSTOMER_PORTAL_LINK = import.meta.env.REACT_APP_STRIPE_CUSTOMER_PORTAL_LINK;
But is getting TS2339: Property env does not exist on type ImportMeta I have tried other solutions based on vite-env.d.ts but causes :
XMLHttpRequest cannot load http://localhost:3001/auth/me due to access control checks.
XMLHttpRequest cannot load http://localhost:3001/auth/me due to access control checks.
because of vite misconfig probably. Any recommendation for this?
21 replies
WWasp
Created by mgp25 on 11/21/2024 in #đŸ™‹questions
Question about shared constants
Hello @Vinny (@Wasp) . Havent tried yet, but seems to be a good approach. We are on 0.13.0 we would need to check if there are backward breaks but we will look into it thank you!
21 replies