sttm-web icon indicating copy to clipboard operation
sttm-web copied to clipboard

Encountering issues while trying to setup repo

Open HarmanSuri opened this issue 5 months ago • 5 comments

Vaheguru Ji Ka Khalsa Vaheguru Ji Ki Fateh!

I wanted to try contributing to this repo, but faced some issues after building the project. I'm working on Windows 11. The site loads on the home page, but clicking any of the links there leads to infinite loading or the "Something isn't working correctly" message.

It seems like api calls aren't working for me either, as I noticed the below error in the DevTools for loading the Writers dropdown:

Access to fetch at 'http://api.banidb.com/v2/writers/' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I followed the setup guide in the README and also tried deleting the repo and re-cloning it, but had no luck. Sorry if this isn't the right place to raise such an issue, but any help would be appreciated in getting set up!

Thanks

HarmanSuri avatar Jul 08 '25 02:07 HarmanSuri

ਵਾਹੇਗੁਰੂ ਜੀ ਕਾ ਖਾਲਸਾ ਵਾਹਿਗੁਰੂ ਜੀ ਕੀ ਫਤਿਹ

Please try hard coding the api urls to https, I believe there is a WIP fix for this on some branch somewhere, but this should get you going 👍

diff --git a/common/api-urls-constants.js b/common/api-urls-constants.js
index 688e801a..4331edab 100644
--- a/common/api-urls-constants.js
+++ b/common/api-urls-constants.js
@@ -1,18 +1,18 @@
 const isProduction = process.env.NODE_ENV === 'production';

 module.exports = {
-  BANIS: isProduction ? '//api.banidb.com/v2/banis' : "//api.khajana.org/v2/banis",
-  PRODUCTION: '//api.banidb.com/v2/',
-  DEVELOPMENT: '//api.khajana.org/v2/',
-  AMRIT_KEERTAN: '//api.banidb.com/v2/amritkeertan',
-  AMRIT_KEERTAN_SHABADS: '//api.banidb.com/v2/shabads',
-  BANNERS: '//api.sikhitothemax.org/messages/web',
+  BANIS: isProduction ? 'https://api.banidb.com/v2/banis' : "https://api.khajana.org/v2/banis",
+  PRODUCTION: 'https://api.banidb.com/v2/',
+  DEVELOPMENT: 'https://api.khajana.org/v2/',
+  AMRIT_KEERTAN: 'https://api.banidb.com/v2/amritkeertan',
+  AMRIT_KEERTAN_SHABADS: 'https://api.banidb.com/v2/shabads',
+  BANNERS: 'https://api.sikhitothemax.org/messages/web',
   SYNC: {
-    PRODUCTION: '//api.sikhitothemax.org/',
-    LOCAL: '//stgapi.sikhitothemax.org/',
+    PRODUCTION: 'https://api.sikhitothemax.org/',
+    LOCAL: 'https://stgapi.sikhitothemax.org/',
   },
-  CEREMONIES: '//api.sikhitothemax.org/ceremonies/',
-  DOODLE: '//api.sikhitothemax.org/doodle/',
-  WRITERS: '//api.banidb.com/v2/writers/',
-  GURBANIBOT: '//gurbanichatbot.sikhitothemax.org/'
+  CEREMONIES: 'https://api.sikhitothemax.org/ceremonies/',
+  DOODLE: 'https://api.sikhitothemax.org/doodle/',
+  WRITERS: 'https://api.banidb.com/v2/writers/',
+  GURBANIBOT: 'https://gurbanichatbot.sikhitothemax.org/'
 };
\ No newline at end of file```

SikhNerd avatar Jul 08 '25 03:07 SikhNerd

Thank you very much, seems to have done the trick!

One last thing: Today's Hukamana is for February 27, 2025. Looking at the code, it seems this is normal behaviour for dev, but I want to confirm whether this is the case.

Thanks

HarmanSuri avatar Jul 08 '25 20:07 HarmanSuri

Looks like that the latest hukamnama that the dev api is currently returning, so expected to display that. @Gauravjeetsingh can you see why dev api doesn't have latest hukamnanas?

SikhNerd avatar Jul 08 '25 21:07 SikhNerd

@SikhNerd veerji, the script that updates hukamnama is only doing it for prod database, I can fix it to update dev database as well.

Gauravjeetsingh avatar Jul 16 '25 04:07 Gauravjeetsingh

Update: Fixed the dev database, also updated the hukamnama job to update dev database on daily basis.

Gauravjeetsingh avatar Jul 17 '25 16:07 Gauravjeetsingh