I can't believe it was so easy to fix... thank you so much!
Ezequiel Falcón
@stormforce133
Posts made by stormforce133
-
RE: Bad Request on Login
-
RE: Bad Request on Login
I have the same initialization but the issue persists... here is my backend code:
let express = require('express'); let app = express(); let bodyParser = require('body-parser'); const fileUpload = require('express-fileupload'); const pgp = require("pg-promise")(); const db = pgp(process.env.DATABASE_URL); app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, x-access-token"); res.header("Access-Control-Allow-Methods", "POST, PUT, DELETE, GET, OPTIONS"); next(); }); app.use(bodyParser.json({'type': '*/*', limit: '20mb'})); app.use(bodyParser.urlencoded({ extended: true })); app.use(fileUpload()); app.set('port', (process.env.PORT || 5000)); app.get('/api', function(req, res) { res.json({ mensaje: "Backend del sistema!!" }) }); const server = app.listen(app.get('port'), function() { console.log('Backend escuchando en puerto ', app.get('port')); }); const reportingApp = express(); app.use('/reportes', reportingApp); const jsreport = require('jsreport')({ express: { app: reportingApp, server: server }, appPath: "/reportes", connectionString: { name: "mongodb", uri: process.env.MONGODB_URI }, blobStorage: "gridFS", authentication: { cookieSession: { "secret": "dasd321as56d1sd5s61vdv32" }, admin: { "username": "admin", "password": process.env.JSREPORT_PASS } } }); jsreport.use(require('jsreport-authentication')({})); jsreport.init().catch(function(e) { console.error(e); });
Am I doing something wrong?
Thanks in advance!
-
RE: Bad Request on Login
I'm using body-parser for JSON and urlencoded... I also use express-fileupload which uses multipart... maybe that is the issue
app.use(bodyParser.json({'type': '*/*', limit: '20mb'})); app.use(bodyParser.urlencoded({ extended: true })); app.use(fileUpload());
I can't remove file-upload as my backend stores some images... is there some workaround?
Thanks in advance! -
Bad Request on Login
Hi there!
I'm having a issue trying to login to my both production and staging servers, I get a "Bad Request" response after I click on Login button..
This is my heroku log:
Aug 19 05:16:22 estetica-backend heroku/router: at=info method=POST path="/reportes/login?returnUrl=%2Freportes" host=estetica-backend.herokuapp.com request_id=e137fd30-40a5-45cd-b1bc-a438907476da fwd="181.10.26.2" dyno=web.1 connect=4ms service=4ms status=400 bytes=573 protocol=https
Aug 19 05:16:22 estetica-backend app/web.1: SyntaxError: Unexpected token u Aug 19 05:16:22 estetica-backend app/web.1: at parse (/app/node_modules/body-parser/lib/types/json.js:83:15) Aug 19 05:16:22 estetica-backend app/web.1: at /app/node_modules/body-parser/lib/read.js:116:18 Aug 19 05:16:22 estetica-backend app/web.1: at invokeCallback (/app/node_modules/raw-body/index.js:262:16) Aug 19 05:16:22 estetica-backend app/web.1: at done (/app/node_modules/raw-body/index.js:251:7) Aug 19 05:16:22 estetica-backend app/web.1: at IncomingMessage.onEnd (/app/node_modules/raw-body/index.js:307:7) Aug 19 05:16:22 estetica-backend app/web.1: at emitNone (events.js:86:13) Aug 19 05:16:22 estetica-backend app/web.1: at IncomingMessage.emit (events.js:185:7) Aug 19 05:16:22 estetica-backend app/web.1: at endReadableNT (_stream_readable.js:974:12) Aug 19 05:16:22 estetica-backend app/web.1: at _combinedTickCallback (internal/process/next_tick.js:80:11) Aug 19 05:16:22 estetica-backend app/web.1: at process._tickCallback (internal/process/next_tick.js:104:9)
I'm running jsreport from my backend like this:
const jsreport = require('jsreport')({ express: { app: reportingApp, server: server }, appPath: "/reportes", connectionString: { name: "mongodb", uri: process.env.MONGODB_URI }, blobStorage: "gridFS", authentication: { cookieSession: { "secret": "asdasdasdasdasd" }, admin: { "username": "admin", "password": process.env.JSREPORT_PASS } } }); jsreport.use(require('jsreport-authentication')({}));
I don't know when this started to happen but I've ever changed any jsreport settings in months. And I don't have any conflicting routes that overlaps the jsreport
/reportes
routeDoes someone have the same issue?
Thanks in advance!
-
RE: jsreport on Heroku: MongoDB credential changes
I found out that all Dynos restart every midnight so the credentials refreshing is not the issue,.. this is happening once every 3 days... it's odd.
All the reports rendering are being made by the API access.. using simple HTTP requests. Is there something I can do to dig a bit more about this issue?Thanks in advance!
-
jsreport on Heroku: MongoDB credential changes
Hi!
I have an issue with my jsreport instance on a Node application hosted on Heroku.
Heroku changes its database credentials once every 3 days as far as I can tell.. The issue is that when this happes, my jsreport instance crashes throwing anerror: unable to load planned schedules MongoError: server instance pool was destroyed
As you can tell, I call the jsreport instance using the
MONGODB_URI
env variable.Is there a way to make jsreport access this env variable each time it needs database access instead of being stored as in-memory variable?
thanks in advance!
-
RE: Display a PDF report in Anuglar app from jsreport backend
The npm packages gives me a nodejs package... but it doesn't make a NgModule so I can't use it directly in Typescript inside a component. Maybe someone with more experience Angular could give me some guidance.
-
RE: Display a PDF report in Anuglar app from jsreport backend
Thanks for your response!
BTW it's Anuglar, not AngularJS.
I'm gonna try with the js file in the index page, but it should be loaded through Webpack -
Display a PDF report in Anuglar app from jsreport backend
Hi!
I'm new here and it seems a nice forum!I'm building an Angular app, and I've the jsreport service running in mi node backend (which also serves as the main CRUD backend for the app).
My current solution takes the desired data and generates the htttp post for the jsreport api which returns a response with the PDF file which is nice.
Now I want to display this PDF in a new windows (in the browser).
It's quite a difficult task since I can't find much neither in Google or Stack Overflow.
I've found that the Browser Client could do that... but I don't know how to import and use the browser client package (jsreport-browser-client-dist) inside my Angular service / component.Thanks in advance!!