Can't upload images to Redmine anymore - ruby

For some strange reason I can't upload images to tickets in Redmine anymore. I can upload a txt file or zip files. When I upload an image in the ticket it either says "Service Unavailable" or "Unprocessable". Weird thing is that it used to work. We updated to the latest Redmine (2.6.0.stable)
I looked at the production.log and this is the error (Can't verify CSRF token authenticity):
Started POST "/uploads.js?attachment_id=1&filename=test.png" for xx.xx.xxx.xxx at 2014-12-03 12:58:49 -0500
Processing by AttachmentsController#upload as JS
Parameters: {"attachment_id"=>"1", "filename"=>"test.png"}
WARNING: Can't verify CSRF token authenticity
Filter chain halted as :verify_authenticity_token rendered or redirected
Completed 422 Unprocessable Entity in 2.6ms (ActiveRecord: 0.3ms)
Here is my Redmine Information:
Default administrator account changed True
Attachments directory writable True
Plugin assets directory writable True
RMagick available (optional) Exclamation
ImageMagick convert available (optional) True
Environment:
Redmine version 2.6.0.stable
Ruby version 1.9.3-p547 (2014-05-14) [x86_64-linux]
Rails version 3.2.19
Environment production
Database adapter Mysql2
SCM:
Git 1.8.2.1
Filesystem
Redmine plugins:
redmine_agile 1.3.2
redmine_ckeditor 1.0.16
redmine_github_hook 2.1.0
redmine_my_page_queries 2.1.6
redmine_theme_changer 0.1.0

It turns out that this was a Varnish Issue. We got around this problem by adding this Varnish rule:
if (req.http.host ~ "my\.domain\.com$") {
return (pipe);
}
Here are some debugging things we did to try to figure out the problem.
Temporarily added config.action_controller.allow_forgery_protection = false to application.rb. When we tried to upload an image it I get a Popup: login required for Server on Redmine API. This gave me a clue that it must have been some kind of server issue.
Created additional_environment.rb and enabled config.log_level = :debug. This added more debug info to the log file.
Started POST "/uploads.js?attachment_id=1&filename=Screen%20Shot%202014-12-11%20at%2010.01.49%20AM.png" for xx.xx.xxx.xxx at 2014-12-11 11:07:41 -0500
Processing by AttachmentsController#upload as JS
Parameters: {"attachment_id"=>"1", "filename"=>"Screen Shot 2014-12-11 at 10.01.49 AM.png"}
^[[1m^[[35m (0.3ms)^[[0m SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings`
^[[1m^[[36mSetting Load (0.3ms)^[[0m ^[[1mSELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'rest_api_enabled' LIMIT 1^[[0m
^[[1m^[[35mAnonymousUser Load (0.3ms)^[[0m SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('AnonymousUser') LIMIT 1
Current user: anonymous
^[[1m^[[36mSetting Load (0.3ms)^[[0m ^[[1mSELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'login_required' LIMIT 1^[[0m
^[[1m^[[35mSetting Load (0.2ms)^[[0m SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'force_default_language_for_anonymous' LIMIT 1
^[[1m^[[36mSQL (1.2ms)^[[0m ^[[1mSELECT `members`.`id` AS t0_r0, `members`.`user_id` AS t0_r1, `members`.`project_id` AS t0_r2, `members`.`created_on` AS t0_r3, `members`.`mail_notification` AS t0_r4, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `projects`.`inherit_members` AS t1_r12, `roles`.`id` AS t2_r0, `roles`.`name` AS t2_r1, `roles`.`position` AS t2_r2, `roles`.`assignable` AS t2_r3, `roles`.`builtin` AS t2_r4, `roles`.`permissions` AS t2_r5, `roles`.`issues_visibility` AS t2_r6 FROM `members` LEFT OUTER JOIN `projects` ON `projects`.`id` = `members`.`project_id` LEFT OUTER JOIN `member_roles` ON `member_roles`.`member_id` = `members`.`id` LEFT OUTER JOIN `roles` ON `roles`.`id` = `member_roles`.`role_id` WHERE `members`.`user_id` = 2 AND (projects.status<>9) ORDER BY projects.name^[[0m
^[[1m^[[35mRole Load (0.2ms)^[[0m SELECT `roles`.* FROM `roles` WHERE `roles`.`builtin` = 2 LIMIT 1
Filter chain halted as :authorize_global rendered or redirected
Completed 401 Unauthorized in 54.3ms (ActiveRecord: 2.7ms)
Current user: anonymous in the log kind of helped lead to the fix.

Related

Failed while loading data from data set SQLQueryDataSet

I am receiving this error:
DataSetError: Failed while loading data from data set SQLQueryDataSet(load_args={}, sql=select * from table)
when I run (within kedro jupyter notebook):
%reload_kedro
c:\users\name.virtualenvs\pipenv_kedro\lib\site-packages\ipykernel\ipkernel.py:283:DeprecationWarning: should_run_async will not call transform_cell automatically in the future. Please pass the result to transformed_cell argument and any exception that happen during the transform in preprocessing_exc_tuple in IPython 7.17 and above.
and should_run_async(code)
2021-04-21 15:29:12,278 - kedro.framework.session.store - INFO - read() not implemented for BaseSessionStore. Assuming empty store.
2021-04-21 15:29:12,696 - root - INFO - ** Kedro project Project
2021-04-21 15:29:12,698 - root - INFO - Defined global variable context, session and catalog
2021-04-21 15:29:12,703 - root - INFO - Registered line magic run_viz
Then this:
catalog.list()
#['table', 'parameters']
catalog.load('table')
where my catalog.yml file contains:
table:
type: pandas.SQLQueryDataSet
credentials: secret
sql: select * from table
layer: raw
However, I am able to pull back the expected result when I run this (within the same kedro jupyter notebook):
from kedro.extras.datasets.pandas import SQLQueryDataSet
sql = "select * from table"
credentials = {
"con": secret
}
data_set = SQLQueryDataSet(sql=sql,
credentials=credentials)
sql_data = data_set.load()
How can I fix this error?
The discrepancy I believe comes from the credentials. In your catalog you had
table:
type: pandas.SQLQueryDataSet
credentials: secret
but in the notebook you were testing with
credentials = {
"con": secret
}
The value mapped in the yaml file should match to the name of an entry in credentials.yml so something like
# in catalog.yml
table:
type: pandas.SQLQueryDataSet
credentials: db_creds
# in credentials.yml
db_creds:
con: secret

nativescript paytm plugin giving 404 Not Found Error nginx/1.6.2

I'm trying to integrate #nstudio/nativescript-paytm plugin into my app.
as a part the first step i have written code to generate checksum. now i'm getting checksum. if i passed this to further steps as I'm getting below error.
Error in console
chromium: [INFO:library_loader_hooks.cc(50)] Chromium logging enabled: level = 0, default verbosity = 0
06-22 07:31:56.479 2762 2762 I cr_BrowserStartup: Initializing chromium process, singleProcess=true
chromium: [ERROR:filesystem_posix.cc(89)] stat /data/user/0/org.nativescript.demo/cache/WebView/Crashpad: No such file or directory (2)
chromium: [ERROR:filesystem_posix.cc(62)] mkdir /data/user/0/org.nativescript.demo/cache/WebView/Crashpad: No such file or directory (2)
My order param is
var order = {
MID: "V************3",
ORDER_ID: "order1",
CUST_ID: "cust123",
INDUSTRY_TYPE_ID: "Retail",
CHANNEL_ID: "WEB",
TXN_AMOUNT: "100.12",
WEBSITE: "WEBSTAGING",
CALLBACK_URL: "https://pguat.paytm.com/paytmchecksum/paytmCallback.jsp",
CHECKSUMHASH: "NDspZhvSHbq44K3A9Y4daf9En3l2Ndu9fmOdLG+bIwugQ6682Q3JiNprqmhiWAgGUnNcxta3LT2Vtk3EPwDww8o87A8tyn7/jAS2UAS9m+c="
};
I'm using github sample of that plugin(javascript version i.e demo) i haven't modified the code.

heroku root :to => 'refinery/pages#home' not work

Start up page worked fine at local
http://localhost:3000
http://localhost:3000/shop
http://localhost:3000/refinery/pages#home
http://www.myweb.com/ not work
In Gemfile:
root :to => 'refinery/pages#home'
mount Spree::Core::Engine, :at => '/shop'
mount Refinery::Core::Engine, at: Refinery::Core.mounted_path
Here what happened:
http://www.myweb.com/shop =========> Work
http://www.myweb.com/pages/home ===> Work
http://www.myweb.com ==============> The page you were looking for doesn't exist.
Problem here: http://www.myweb.com not work
Don't know why. Could anyone fix this
Thanks
Here what I found in heroku after pushed:
Problem:
In logs refinery searched for record with ["link_url", "/" but none
that is the error in data not the routes.rb
So I should assumed this is a bug of refinery
2016-11-19T23:47:41.062659+00:00 app[web.1]: Refinery::Page Load (2.3ms) SELECT "refinery_pages".* FROM "refinery_pages" WHERE "refinery_pages"."link_url" = $1 LIMIT 1 [["link_url", "/"]]
2016-11-19T23:47:41.077929+00:00 app[web.1]: Refinery::Page Load (1.4ms) SELECT "refinery_pages".* FROM "refinery_pages" WHERE "refinery_pages"."menu_match" = $1 ORDER BY "refinery_pages"."id" ASC LIMIT 1 [["menu_match", "^/404$"]]
2016-11-19T23:47:41.118752+00:00 app[web.1]: Rendered public/404.html (1.5ms)
Quick Solution:
Edit the record column "link_url" with "/"

Support of HAVING for Sphinx running in Heroku

I have the following query:
search(params[:query],
with: { tag_id: params[:filter].values.flatten },
group_by: :technology_id,
having: "COUNT(*)=#{params[:filter].size}"
)
This is working locally, but when I deploy to heroku it throws:
ActionView::Template::Error (sphinxql: syntax error, unexpected IDENT, expecting $end
near 'HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META' - SELECT *, groupby() AS
sphinx_internal_group, id AS sphinx_document_id, count(DISTINCT sphinx_document_id) AS
sphinx_internal_count FROM `technology_core` WHERE MATCH('cancer') AND `tag_id` IN (1) AND
`sphinx_deleted` = 0 GROUP BY `technology_id` HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META):
The sphinx version is specified as follows:
# config/thinking_sphinx.yml
test:
mysql41: 9307
production:
version: '2.2.6'
Anyone knows what else could be?
At this point in time, the latest Sphinx version available on Flying Sphinx servers is 2.2.3 - can you change the version in your thinking_sphinx.yml, deploy and run rebuild/regenerate, and see if HAVING works?

Shibboleth authentication in Rails

I am having a struggle getting this to work so I've created a hell-world Rails app to try and get this to work.
Here's the repo with the code that is not working: https://github.com/pitosalas/shibtry
Here's what I've done starting from an empty Rails application:
I've added two gems to gem files:
gem 'omniauth-shibboleth'
gem 'rack-saml'
I got the shibboleth meta data from my university's web site and converted it using shib_conv.rb into the corresponding YAML: ./config.yml
I've updated routes adding get '/auth/:provider/callback', to: 'sessions#create'
I've put a breakpoint at SessionController#create
I've added initializers: omniauth.rb:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :shibboleth, {
:shib_session_id_field => "Shib-Session-ID",
:shib_application_id_field => "Shib-Application-ID",
:debug => true,
:extra_fields => [
:"unscoped-affiliation",
:entitlement
]
}
end
I've added rack_sam.rb initializer:
Rails.application.config.middleware.insert_after Rack::ETag, Rack::Saml,
{ :metadata => "#{Rails.root}/config/metadata.yml"}
Now, run the server and go to http://0.0.0.0:3000/auth/shibboleth and I get an error:
undefined method `[]' for nil:NilClass'
which is traced back to this line in rack-saml/misc/onelogin_setting.rb line 13 which is:
settings.idp_sso_target_url = #metadata['saml2_http_redirect']
in other words, looking for the metadata hash for that key. It happens that in my metadata.yml file that key is present, but by the time I get to this onelogin_setting.rb line 13, #metadata is nil (it should contain the contents of the file) and consequently that key doesn't exist.
And that's where, for now, the trail dries up.
I bypassed Shibboleth totally. My goal was to allow login to my universities authentication system specifically to allow students to log in with their student login, which is fronted by google apps. So this was much easier: https://developers.google.com/identity/sign-in/web/
Looks like you forgot to add your config file to the initializer:
Rails.application.config.middleware.insert_after Rack::ETag, Rack::Saml,
{
:metadata => "#{Rails.root}/config/metadata.yml",
:config => "#{Rails.root}/config/rack-saml.yml"
}
And the saml_idp setting in the rack-saml.yml must match the key for the idp_lists entry in your metadata.yml

Resources