searchkick reindex not working in staging env - searchkick

In development environment Moment.reindex and search is OK, but in staging env is error:
2.3.1 :002 > Moment.reindex
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to parse content to map"}],"type":"parse_exception","reason":"Failed to parse content to map","caused_by":{"type":"json_parse_exception","reason":"Duplicate field 'moment'\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput#1e0d7046; line: 1, column: 2720]"}},"status":400}
staing env using same ES.
My Moment class:
class Moment
include Mongoid::Document
searchkick inheritance: true, callbacks: :async, merge_mappings: true, mappings: {
moment: {
properties: {
text: {
type: "text",
# analyzer: "ik_max_word",
fields: {
analyzed: {
type: "text",
analyzer: "ik_max_word"
}
}
}
}
}
}}
GET /_cat/indices?v
health status index
yellow open moments_development_20180223203756302
yellow open moments_staging

This was an issue with how mappings were merged. It's fixed in the latest version of Searchkick.

Related

Arm template for Azure data factory with diagnostics settings in bicep

I have the following bicep to create ADF resource:
resource dataFactory 'Microsoft.DataFactory/factories#2018-06-01' = {
name: name
identity: {
type: 'SystemAssigned'
}
properties: {
globalParameters: {
environment: {
type: 'String'
value: environmentAbbreviation
}
}
}
location: location
}
I need to add a diagnostic setting to ADF resource as follows:
How do I update the bicep?
I tried to create diagnostic settings in ADF using Bicep. Below is the code.
Bicep code for creating data factory
This code is for creating data factory. It is same as the code in question.
param settingName string='XXXXX'
param factoryName string='XXXXX'
resource datafactory 'Microsoft.DataFactory/factories#2018-06-01' = {
name: factoryName
location: resourceGroup().location
identity: {
type: 'SystemAssigned'
}
properties: {
}
}
Bicep code for adding diagnostic setting
In order to add diagnostic setting to data factory, below code is added along with the code to create data factory.
resource factoryName_microsoft_insights_settingName 'Microsoft.DataFactory/factories/providers/diagnosticSettings#2017-05-01-preview' = {
name: '${factoryName}/microsoft.insights/${settingName}'
location: resourceGroup().location
properties: {
workspaceId: 'XXXX'
logAnalyticsDestinationType: 'Dedicated'
logs: [
{
category: 'PipelineRuns'
enabled: true
retentionPolicy: {
enabled: false
days: 0
}
}
{
category: 'TriggerRuns'
enabled: true
retentionPolicy: {
enabled: false
days: 0
}
}
{
category: 'ActivityRuns'
enabled: true
retentionPolicy: {
enabled: false
days: 0
}
}
]
metrics: [
{
category: 'AllMetrics'
timeGrain: 'PT1M'
enabled: true
retentionPolicy: {
enabled: false
days: 0
}
}
]
}
dependsOn: [
datafactory
]
}
When the above both codes are combined and run, resources got deployed successfully.
The above code will enable the categories - Pipeline runs log,Trigger runs log, Pipeline activity runs log. Change the code as per the requirement.
Reference: Microsoft.Insights/diagnosticSettings - Bicep, ARM template & Terraform AzAPI reference | Microsoft Learn

Failures: No manifest was fetched. with Nuxt/pwa module 2.6.0

currently using "#nuxtjs/pwa": "2.6.0" having the issue manifest not registering on lighthouse analysis, service worker also taking time.
specific lighthouse error Failures: No manifest was fetched.
I can help with code also if needed!!
My nuxt.config.js
build: {
publicPath: cdn.com
},
modules: [
'#nuxtjs/axios',
'#nuxtjs/pwa'
],
manifest: {
name: 'name',
description: "Desc",
theme_color: '#607D8B',
short_name: 'shortname'
},
Using Docker deployer. upload the content of .nuxt/dist/client directory to your CDN (PublicPath Docs Nuxt)
According to the docs you have to wrap manifest object into pwa: https://pwa.nuxtjs.org/manifest
Try this:
// Nuxt config
pwa: {
manifest: {
name: 'name',
description: "Desc",
theme_color: '#607D8B',
short_name: 'shortname'
}
}

testing sails/mysql with fixtures primary key issue

I have a sails app working against a legacy database (MySQL) and I would like to perform integration tests. I am using fixtures to load data into a separate test database using barrels. When I run my tests I get an error:
[Error (E_UNKNOWN) Encountered an unexpected error] Details: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
Interview.js api/models/Interview.js:
module.exports = {
tableName: 'interview',
attributes: {
interviewId: {
type: 'integer',
columnName: 'interview_id',
primaryKey: true,
unique: true
},
...
}
};
interview.json tests/fixtures:
[
{
"interviewId": 1,
"title": "some string",
"createdDate": "2015-11-23T09:09:03.000Z",
"lastModified": "2015-11-23T09:09:03.000Z"
},
{...}
]
test environment config/env/test.js :
models: {
connection: 'test',
migrate: 'drop',
autoPK: false,
autoCreatedAt: false,
autoUpdatedAt: false
}
The problem seems to lie in defining a primary key in the schema rather than letting sails create one automatically. If I remove the interviewId field from the model and set autoPK: true it works. But this does not accurately represent my data structure.
App info:
sails#0.11.2 sails-mysql#0.11.2 waterline#0.10.27 barrels#1.6.2 node v0.12.7
Many thanks,
Andy

TDD of Sailsjs Waterline Models with Vowsjs

My problem is trying to do TDD of Waterline models. The tests I present are just boilerplate to get my suite constructed. Nevertheless, they raise valid issues. The primary problem is that I require the model in the Vows.js test. In the test scope the model is defined, but it does not have any properties inherited from the Waterline package. For example, here is some model code for "EducationLevel":
module.exports = {
migrate: 'safe',
tableName: 'education_levels',
attributes: {
id : { type: 'integer', required: true },
description: { type: 'string', required: true },
display_sort: { type: 'integer', required: true}
}
};
And here are some trial tests:
vows = require('vows')
assert = require('assert')
EducationLevel = require('../api/models/EducationLevel')
vows.describe('tac_models').addBatch({
'EducationLevel model' : {
topic: function(){
educationLevel = EducationLevel.create();
return true;
},
'It exists': function (topic) {
assert.equal(EducationLevel.create,undefined);
assert.equal(EducationLevel.migrate,undefined);
}
}
}).export(module)
When I run the test, the first assertion passed, but the second does not:
vows spec/*
✗
EducationLevel model
✗ It exists
» expected undefined,
got 'safe' (==) // tac_models.js:13
✗ Broken » 1 broken (1.545s)
This shows that the test knows only what is explicitly declared in the EducationLevel definition. The 'migrate' property is defined because I explicitly define it in the code. It does not know about the Waterline method 'create'. How can I remedy this in a way that makes conventional TDD practical?

Configure Karma-dojo to use local repository of dojo

I'm trying to set up a local testing environment for my Dojo project. I've decided on Karma as the test runner and Jasmine as the suite. I've found a few example karma.config files on how to set it up and that works fine.
But when I try to set up the dojo.config in main test file to point to a local version of dojo it just breaks.
This works:
var dojoConfig = {
packages: [
{
name: 'dojo',
location: 'http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo'
}, {
name: 'dojox',
location: 'http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox'
}, {
name: 'dijit',
location: 'http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dijit'
}
],
async: true
};
But as soon as I do something like this:
var dojoConfig = {
packages: [
{
name: 'dojo',
location: 'base/lib/dojo'
}, {
name: 'dojox',
location: 'base/lib/dojox'
}, {
name: 'dijit',
location: 'base/lib/dijit'
}
],
async: true
};
This is the error log:
ERROR: 'There is no timestamp for /base/lib/dojo/domReady.js!'
ERROR: 'There is no timestamp for /base/lib/dojo/_base/array.js!'
WARN [web-server]: 404: /base/lib/dojo/domReady.js
Then it runs through and outputs the same for all dojo modules.
That's an odd error... I can't give you much more than a Google search (You did google your error right?), but have you seen these questions?
test not running on karma/jasmine/require.js 'There is no timestamp for *lib*!' error
karma error 'There is no timestamp for'