You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I just cloned the repo in a fresh Debian 12 container with node v21.7.3.
upon running npm run start i got the following error:
> gptportal@1.0.0 start
> node server.js
/home/user/GPTPortal/server.js:12
app.use(bodyParser.json({ limit: '50mb' }));
^
ReferenceError: Cannot access 'app' before initialization
at Object.<anonymous> (/home/giorgio/GPTPortal/server.js:12:1)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Module._load (node:internal/modules/cjs/loader:1021:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49
Which i solved by rearranging some lines in the server.js file:
// importing required node packagesrequire('dotenv').config();constexpress=require('express');constaxios=require('axios');constbasicAuth=require('express-basic-auth');constfs=require('fs');const{ marked }=require('marked');constbodyParser=require('body-parser');constapp=express();// Move this line up hereconstdownload=require('image-downloader');constcors=require('cors');// Increase the limit for JSON bodiesapp.use(bodyParser.json({limit: '50mb'}));app.use(bodyParser.urlencoded({limit: '50mb',extended: true,parameterLimit: 50000}));app.use(express.json());// for parsing application/jsonapp.use(express.static('public'));// Serves your static files from 'public' directoryapp.use(cors());constrouter=express.Router();const{v4: uuidv4}=require('uuid');// openaiconstOpenAI=require('openai').default;// <other code remains the same>
However, when i try to access the application from the network: http://<local-server-ip>:3000/portal i get into a redirect loop to http://<local-server-ip>:3000/public/portal.htmlThe page isn’t redirecting properly.
I'd appreciate some ideas on how to fix this, i'd love to try this app.
The text was updated successfully, but these errors were encountered:
Now i can access http://:3000/portal, but i get a CORS error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/message. (Reason: CORS request did not succeed). Status code: (null)".
When running locally, it works without producing the above error.
Hello, I just cloned the repo in a fresh Debian 12 container with node v21.7.3.
upon running
npm run start
i got the following error:Which i solved by rearranging some lines in the server.js file:
However, when i try to access the application from the network:
http://<local-server-ip>:3000/portal
i get into a redirect loop tohttp://<local-server-ip>:3000/public/portal.html
The page isn’t redirecting properly
.I'd appreciate some ideas on how to fix this, i'd love to try this app.
The text was updated successfully, but these errors were encountered: