Magento 2.4: Unable to apply data patch Magento\CatalogRuleSampleData\Setup\Patch\Data\InstallCatalogRuleSampleData - magento2

Getting the below error while trying to install sample data and upgrading the setup in Magento 2.4.2-p1
Error: Unable to apply data patch Magento\CatalogRuleSampleData\Setup\Patch\Data\InstallCatalogRuleSampleData for module Magento_CatalogRuleSampleData. Original exception message: Rolled back transaction has not been completed correctly.
Please help.

Syntax error(s) are existed in the following sample csv files.
/vendor/magento/module-catalog-rule-sample-data/fixtures/catalog_rules.csv
/vendor/magento/module-sales-rule-sample-data/fixtures/sales_rules.csv
2 solutions for the above issue:
Fix and validate the above CSVs manually or online tool like https://csvlint.io/
Comment line of code, calling above CSVs
\Magento\CatalogRuleSampleData\Setup\Installer.php
\Magento\SalesRuleSampleData\Setup\Installer.php
like:
/**
* {#inheritdoc}
*/
public function install()
{
//$this->rule->install(['Magento_CatalogRuleSampleData::fixtures/catalog_rules.csv']);
}

I also received the same error and invested four days rectifying it.
I also tried the above solution, i.e., commenting the line under install function from catalogue rule sample data and sales rule sample data. It too worked, but only temporarily. Because after following the above procedure, you cannot see the products from your Magento homepage, just banners only visible to you.
The real problem is that there is no sufficient space to deploy the sample data. Clear more than 4GB of space on your system and try it. It will work.

You need to set correct permissions for var/ pub/ & generated/ directories
after above, your error will be vanished on setup:upgrade

I had such a problem and recovered by running the command:
php bin/magento sampledata:remove
After upgrading, just run normally.

Related

How can I set grafana 7 to work with warp10 2.7.x?

I've just install a fresh warp10 standalone server version 2.7.2.
Using beamium to send data into it and seeing the data via the VScode plugin is OK and I can see graph in GTS preview.
I've also installed a fresh grafana and warp10-plugin following the warp10 recommandation on the ovh github.
When execution a default warp10 query (via editor), grafana add some strings in the query, like the start or end value, so in the end the query look like:
1609947849757000 'start' STORE
'2021-01-06T15:44:09.757Z' 'startISO' STORE
1610034249757000 'end' STORE
'2021-01-07T15:44:09.757Z' 'endISO' STORE
86400000000 'interval' STORE
199538106 '__interval' STORE
199538 '__interval_ms' STORE
[ 'host.local.domain' ] 'host_list' STORE
But when executing, there is an error poping in the warp10 logs, after decryption it tell:
Exception at '=>1609947849757000<= 'start' STORE '2021-01-06T15:44:09.757Z'' in section [TOP]
It seems that it don't take the LONG (DOUBLE?) number for what it is, and try to match a function with the same name that don't exists.
On grafana side, I don't have any valuable help, it tell me:
WarpScript Failure on Line -1, Unable to read x-warp10-error-line and x-warp10-error-line headers in server answer
Do I miss something ?
==== Edit: 2021-01-07 17:32 UTC
After first reply, doing other test:
I've tryied the same query, and the error is still the same.
Warpscript failure
But in VScode this query works:
{
'token' $RTOKEN
'class' '~.*'
'labels' {}
'end' '2021-01-07T17:35:28.086Z'
'timespan' 21600000000
} FETCH
I've also try to use the bartender stuff in grafana and it work fine too...
So everything should work, I must miss the obvious.
Can Java version have an impact ?
If the datasource is working, you didn't miss anything.
Do you use the built in warpscript editor ? Make sure you ticked the "WarpScript Editor" checkbox:
Then, do the simplest FETCH request you can do, or copy paste the code you did in VSCode.
You can define your own variables too in the datasource configuration. It is usefull for tokens.
I just setup Grafana 7.3.6 + ovh plugin to check, it seems there is no regression issue.
The full WarpScript can be found in the browser console.
The header error is linked to Grafana 7, no problem with Grafana 6.x. Install Grafana 6.x if you want WarpSript detailed errors.
Edit: Issue is now fixed and merged into ovh github master.
If you want to test another Warp 10 data source, you can use the credential and advices in this article. You just need to go before covid lockdown to find relevant office beertender data...

Error 403 with Ckan 2.6.2 - Datapush

I have, in order to process some big data, to set up ckan on a local machine. I've set up the whole system following this guide : http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html
I wanted to display a preview of a locally loaded file, so the user can actually see it before downloading it. And it doesn't work, because it only works for online files. For instance, it DOES work with this online file but NOT with my own file I upload.
So, I've been interested about Datastore and Datapusher. I've followed every part of the guide, and it appears on my ckan. However, I have an error. Specifically this one :
Upload error: An Error occurred while sending the job: 403 Client Error: Forbidden for url: http://127.0.0.1:8800/job
Here's my most important parts about my production.ini file (copying the whole would be very long) :
ckan.site_url = http://localhost
ckan.plugins = datastore datapusher stats text_view image_view
recline_view recline_graph_view recline_map_view webpage_view
ckan.datapusher.formats = csv xls xlsx tsv application/csv
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
ckan.datapusher.url = http://127.0.0.1:8800/
I truly have no idea about what my problem could be, I tried to change the datapusher.url to 0.0.0.0 as the guide suggested, but it doesn't work either.
If the data to be added to CKAN is in a file on your computer, select “Upload a file” option. CKAN will give you a file browser to select it. You should use link to a file option just for publicly available resources.
Have you installed datapusher also? Its a separate process running on port 8800. CKAN uses datastore to be able to have a grid view of tabular data. Data needs to be pushed through datapusher to be used by datastore.
Yes, you need to set up the Datapusher.It's not activated by default.
Pull the datapusher code, install the dependencies and run it using:
python datapusher/main.py deployment/settings.py
The instructions to configure the settings are on the repository.
Here's the datapusher manual: http://docs.ckan.org/projects/datapusher/en/latest/
Here's the repository: https://github.com/ckan/datapusher
Had the exact same error message.
This post solved my issue though.
short: insert/check the following in your virtualhost in /etc/apache2/sites-enabled/datapusher.conf
<Directory /etc/ckan>
Options All
AllowOverride All
Require all granted
</Directory>

FactoryGirl.create issues "LocalJumpError: no block given (yield)" with Rails 5

I'm in the process of upgrading my app to Rails 5
When running the tests with rails 5 enabled I started to get "LocalJumpError: no block given (yield)" on several object creation sentences like this one:
let!(:entity) { create(:entity) }
This started to happen after I upgraded to Rails 5.0.0
I tried using build instead of create on that line and the error doesn't show up in that case.
Has anyone got a similar issue?
My Entity factory is this one:
FactoryGirl.define do
factory :entity do
entity_type 'A'
account { create(:account) }
ilk []
after(:build) do |entity|
entity.names << build(:name)
entity.addresses << build(:address)
end
trait :incomplete do
incomplete true
end
end
My Gemfile looks like this: https://jpst.it/Lb6N
EDIT
I found out the issue is not with FactoryGirl but with Mongoid gem. I opened a ticket on JIRA for that project. Here's the link but you'll need to have an account with access to Mongoid project at JIRA: https://jira.mongodb.org/browse/MONGOID-4302
The details of this ticket are that by running rspec -b to see the trace, I identified the issue on this line on the mongoid gem:
https://github.com/mongodb/mongoid/blob/master/lib/mongoid/clients/options.rb#L25
The issue disappears if I replace that line (yield self) with just:
self
I'm not sure however if this is a feasible fix, so I opened the ticket mentioned before to get mongoid's feedback and see what can be done.
I'll update again when I get any feedback.
After a lot of debugging I found the source of the issue on a local fork of the mongoid_token gem, which was causing this weird problem. Mongoid and FactoryGirl gems are not related to this issue, neither the original mongoid-token gem.

Magento: Add New Product Form not displaying in Admin

I've just installed the magento and when I tried to add new product from admin,But now product form is not being displaying. I can see the page like this
what should I do? Please, I searched through Google, but, couldn't find any appropriate answer.
Have you already tried to clear cache and cookies? also some times you have to do it on the shell on /path/to/my/magento/folder/var/cache just run "rm -fr *".
If that doesn't work you can check you files ownership and permissions (the http service has to have the write write permissions an ownership on the files and folder - http://www.magentocommerce.com/wiki/groups/227/resetting_file_permissions).
Hope that works for you.
You could try enabling display_errors in index.php i.e.
ini_set('display_errors', 1);
Also you could enable logs in your backend, and check for errors in system.log and exception.log
As Magneto's back end makes heavy use of prototype.js, check your console for errors .

Why does my Apache2::Log output replace newlines with \n?

I've set up multiple vhosts under apache2 / mod_perl. I used the ErrorLog directive to get a separate error log for each vhost. This only worked as expected when I used Apache2::Log. 'warn' would only log to the regular error log.
So that's all working. Finally. But there's one issue remaining: When I log via $r->log_error, I find that newlines are replaced with \n
Any idea why this happens, and how it can be fixed?
Thanks.
This is not a mod_perl problem, but an Apache one. Apparently there are some security concerns with printing unescaped output to the error logs (I'm not entirely sure why) so you have to explicitly enable this in Apache when building/configuring it using this:
CFLAGS=-DAP_UNSAFE_ERROR_LOG_UNESCAPED ./configure
If you're using an already installed apache, there's not much you can do to change this.
If you have a pre-built install, you can use this line of code to fix the issue but it must be included in every page execution within your vhost, say in a header.php or config.php file.
ini_set('error_log','/var/log/apache2/error.log');
i know this is very old thread, but still coming on top on google results, so just to help all, the following changes in mod_perl.pl did helped me:
comment out below:
BEGIN { *CORE::GLOBAL::warn = \&Apache2::ServerRec::warn; }
the above is for:
Make warnings go to the virtual host's log and not the main server log.
i hope this helps anyone out there like me :)