Heroku - Can't access or create database JSON data of ruby app, error HTTP 500 - json

I'm having a problem in Production when accessing the JSON (let's call it mydata.json) where I store the data of my ruby webapp, deployed with Heroku. The way I access the download of this file is by putting into the browser:
my-heroku-page.herokuapp.com/mydata.json
but I get the HTTP 500 error page.
Always using the browser, when I try to create it I get the Ruby page:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
First I must say I'm using the same source code I used for another webapp that is actually working, I just modified the database.yml according to my new host, database, username and password. The previous webapp was perfectly working, i.e I could create the table and access the data. Secondly the error doesn't occur with localhost.
I tried to create a Dataclip in Heroku:
Select * from mydata order by created_at desc;
but I get the error:
"Your query couldn't be created."
ERROR: relation "mydata" does not exist
LINE 3: FROM mydata
Plus when I check the heroku pg:info I get 0 Tables
=== DATABASE_URL
Plan: Hobby-dev
Status: Available
Connections: 0/20
PG Version: 9.5.5
Created: 2016-11-15 08:30 UTC
Data Size: 7.4 MB
Tables: 0
Rows: 0/10000 (In compliance)
Fork/Follow: Unsupported
Rollback: Unsupported
Add-on: postgresql-convex-54172
It seems like mydata.json is not created in production, but in localhost is working fine and I can create/download a blank one. I'm sure I'm missing something easy here, maybe in the database.yml.
I will edit the question if additional info are required. Any help is appreciated.
Thanks,
Simone

Related

Getting error 400 - registration error when run sym command and how to perform two way sync using SymmetricDS

I am trying to sync two database on same machine(just for testing) using symmetricDS. I have performed below installation steps.
Two copy of Symmetric set up ,sym-corp and sym-store
Corp and store 's property file are set up for mysql DB.
registered the copr
bin\sysadmin --engin corp-000 open-registration store 001
Start sym cmd but throwing below error
bin\sym --engine store-001 --port 8080
[store-001] [DataLoaderService] [store-001-job-3] Using registration > URL of http://localhost:8080/sync/corp-000/registration 2021-01-08
WARN [store-001] [SymmetricServlet] [qtp1325866488-13] > The request
path of the url could not be handled. Check the > engine.name of the
target node vs. the sync URL of the source node.> The request was
/corp-000/registration from the host 127.0.0.1 with an ip address of
127.0.0.1.
[store-001] [RegistrationService] [store-001-job-3] Unexpected error during registration: Received an unexpected response code of 400 from the server StackTraceKey [HttpException:3422623218]
Don't know What is this error, I am trying to clear my base but still no luck yet. I have reviewed official tutorial link but still no luck.
Could you please help me with below queries. This will be great help and also useful for all beginners.
Can you run multiple sym instance on same machine ?
Once set up done Should I run sync for both corp and store ?
Corp and Store 's configuration are correct or not ? if not what is incorrect and why ?
What other steps are missing to run two way syc ?
the problem may be with the line
registration.url=sync.url=http://localhost:8080/sync/corp-000
in corp-000.properties. could you try splitting it to two lines:
registration.url=
sync.url=http://localhost:8080/sync/corp-000

Symfony 4 framework session handler error

I'm using symfony 4, What does error stands for ?
Warning: SessionHandler::read(): open(/var/lib/php/sessions/sess_634q91mh896b6aa4jpjvlihmar, O_RDWR) failed: Permission denied (13)
When a user logs into a Symfony application, session information is stored on the web server. By default Symfony uses the native PHP session mechanism, storing session info in a file in /var/lib/php/sessions/ on Linux systems. Your error message is output by PHP and means it got a permissions error creating or re-opening a session file.
The error appears only intermittently because PHP removes old session files randomly about every 1/100th or 1/1000th page load. (On some Linux variants, old session files are removed by a cron job instead.)
https://symfony.com/doc/current/session.html says:
"some session expiration related options may not work as expected if other applications that write to the same directory have short max lifetime settings."
Try to avoid having multiple processes writing to the same sessions directory. I think I got the error message because both an Apache web server and php bin/console server:start were running at the same time. One process may have removed the other process's session file.
See PHP manual and Symfony manual for how to configure writing to separate directories. For example, I changed {Symfony directory}/config/packages/framework.yaml:
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
# handler_id: ~
cookie_secure: auto
cookie_samesite: lax
handler_id: 'session.handler.native_file'
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
gc_probability: 100 # Run garbage collection always for
gc_divisor: 100 # investigating this problem only.
Another possibility is a problem in your Symfony code can cause the error message. The Symfony documentation says not to call the PHP session functions like session_start() directly since Symfony classes call them. A bug in my code caused an exception which I speculate caused the error message.
Related stack overflow questions: cleanup-php-session-files and how-does-php-know-when-to-delete-a-session
For those familiar with C code, see the PHP interpreter source code line that prints the error here
Hope this helps!
Not related to symfony 4, but you have to fix permissions in your /var/lib/php/sessions/ directory

Sonar 3.5.1/sonar-runner 2.2 fails with BadDatabaseVersion

I have installed Sonar 3.5.1 on a brand new PostgreSQL 9.2 database. The server seems to run fine, but sonar-runner (v2.2) fails with the following error:
Caused by: org.sonar.core.persistence.BadDatabaseVersion: The current batch process and the configured remote server do not share the same DB configuration.
- Batch side: jdbc:postgresql://10.1.0.210/sonar (postgres / *****)
- Server side: check the configuration at http://sonar.kopitoto/system
I am pretty confident that there is no other concurrent installation of Sonar pointing to the same database, because:
This is the first Sonar installation in this organization, ever
The value of sonar.core.id in the DB matches the value returned by the Sonar server:
Getting the value from the DB:
sonar=# SELECT text_value FROM properties WHERE prop_key = 'sonar.core.id';
text_value
----------------
20130525192736
(1 row)
Getting the value from the server:
$ curl http://sonar.kopitoto/api/server
<?xml version="1.0" encoding="UTF-8"?>
<server>
<id>20130525192736</id>
<version>3.5.1</version>
<status>UP</status>
</server>
Sonar-runner's properties:
sonar.host.url: http://sonar.kopitoto
sonar.jdbc.driverClassName: org.postgresql.Driver
sonar.jdbc.password: *****
sonar.jdbc.schema: public
sonar.jdbc.url: jdbc:postgresql://10.1.0.210/sonar
sonar.jdbc.username: postgres
Of course, the password is not five stars, but I checked it twice. If I change it a little bit, the runner fails earlier with authentication error. So a password mismatch is ruled out.
Server's sonar.properties:
sonar.jdbc.username: postgres
sonar.jdbc.password: *****
sonar.jdbc.url: jdbc:postgresql://10.1.0.210/sonar
sonar.jdbc.driverClassName: org.postgresql.Driver
sonar.jdbc.schema: public
Again, the password above is not five stars, but I am pretty sure it is correct. The server logs say nothing about errors, and shows how the database schema is initialized when I stop the thing, drop the database, create an empty one, and then start the Sonar server again.
Am I missing something?
At this point, I am thinking that this is a bug in Sonar (probably in sonar-runner). Unfortunately, Sonar's issue-tracking system is littered with such reports, all closed with "Not a bug" resolution. I guess I will be dismissed similarly if I reopen one of those issues.
So I hope I am really missing something here.

Application Verifier 6.2 (x64) AVRF: failed to create verifier log file status C0000022

My Windows Store app keeps getting rejected from certification testing and I managed to reproduce a consequent crash when running appverif's LuaPriv-check. I get this output though:
AVRF: failed to create verifier log file \??\C:\Users\xx\AppVerifierLogs\yy.exe.0.dat (status C0000022)
Process Monitor tells me yy.exe got ACCESS DENIED on a CreateFile operation in this folder. I have set full access to all users (the user reported in the log was the same as the owner of the folder). I am running Visual Studio and Application Verifier as Administrator, but this does not seem to apply. What is the correct way of giving user xx full access to this folder on win8? I have attempted to use different log folders for appverify but with no success. Anyone else able to use this tool with Store-apps?
This post describes similar issues. Attempting to run AppVerif –sppath C:\MyLogsLocation as in the suggested workaround gives AVRF: Error: Incorrect image name: <
So does running appverif -enable handles locks -for myapp.exe -sppath c:\MyLogsLocation
It might be a bug in app verifier.
Have a look at these links:
http://social.technet.microsoft.com/Forums/en-US/5ed560c0-76af-401d-8150-8cd1e69d0b8a/why-app-verifier-can-not-create-log-file?forum=windowssdk
http://blogs.msdn.com/b/dougste/archive/2010/01/11/generating-application-verifier-logs-for-web-applications.aspx
0xc000022 is STATUS_ACCESS_DENIED. The process doesn't actually have write permissions, even if it looks like it should. This MSDN blog explains there is a bug in App Verifier so even if you specify -sppath the value won't be honoured unless you first delete the %WINDIR%\system32\config\AppVerifierLogs\ folder.

WSO2 App Store throws error when attempting to save a users Application against mysql

API Store is throwing errors when I try to create or edit an application
java.sql.SQLException: Can't call commit when autocommit=true
I've added the setting of
init-command='set autocommit=0'
to the my.cnf file
I've also added the flag:
?relaxAutoCommit=true
to the connection string but to no avail. I continue to get this error.
I am using the same mysql database for both the WSO2_CARBON_DB and teh WSO2AM_DB plus I have a single publisher node and two separate store nodes all pointing to the same mysql datasource.
I notice the application edit is saved (or the new application is created) but the exception is still thrown in the console and an error message appears in the user interface (as per the error at the top of this question).
Is there some other setting, within the WSO2 conf files that I have to tweak in order to get this to work properly?
Add both autoReconnect and relaxAutoCommit flags to the jdbc url of your defined "WSO2AM_DB" datasource in master-datasources.xml file. This will resolve your issue.
<configuration>
<url>jdbc:mysql://localhost:3306/AM_DB?autoReconnect=true&relaxAutoCommit=true</url>
<username>xxxx</username>
<;password>xxxxx</password>
EDIT: I updated the url to reflect the correct syntax for escaping the ampersand.
just for the sake of completeness, the JDBC URL shoud be
jdbc:mysql://localhost:3306/WSO2CARBON_DB?autoReconnect=true&relaxAutoCommit=true