Updating issue using Redmine API - json

I'm trying to make a little app which updates redmine issues. To start with I wanted to test the API calls to make sure I knew what I'm doing and already hit a wall.
I fired up postman with a PUT
URL
http://address:port/issues/1.json
headers:
Content-Type:application/json
X-Redmine-API-Key:MYKEY
X-Redmine-Switch-User:MYUSERNAME
body:
{"issue": { "id":"5729", "subject": "This change happens", "status": { "id": "1", "name": "This change is ignored" } } }
However when I hit send and look in redmine only the subject has been updated, the status doesn't change. I can see also that the last updated field updates to the current time/date.
I've seen several answers to questions like this already, but the solution always seems to be adding the content type to the header... and I've already got that.
Am I missing something obvious?
Here is my redmine environment if relevant:
Environment:
Redmine version 2.5.1.stable
Ruby version 1.9.3-p0 (2011-10-30) [i386-mingw32]
Rails version 3.2.17
Environment production
Database adapter PostgreSQL
SCM:
Subversion 1.8.13
Mercurial 3.4
Git 1.9.5
Filesystem
Redmine plugins:
clipboard_image_paste 1.8
redmine_backlogs v1.0.6
redmine_ckeditor 1.0.16
redmine_dashboard 3.0.0.dev0
redmine_issue_checklist 2.0.5
redmine_questions 0.0.5
redmine_release_notes 1.3.1
redmine_repobrowser 1.3.0
redmine_user_specific_theme 0.0.1
redmine_wiki_extensions 0.6.3
redmine_wiki_lists 0.0.3

According to http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue, it looks like you should only pass in the status id, as "status_id". Could you try something like this?
{"issue":
{
"id":"5729",
"subject": "This change happens",
"status_id": "1"
}
}

Related

Cloud SQL minor patch upgrade not working for MySQL

As per release notes I should be able to upgrade the minor patch of the database, which by default is 8.0.26 in newly fresh instances:
May 26, 2022
Cloud SQL for MySQL now supports minor version 8.0.29. To upgrade your existing instance to the new version, see Upgrade the database minor version.
I triggered a minor patch upgrade using GCP CLI for MySQL. The command output is successful but the database patch didn't change. Used the following command:
$ gcloud sql instances patch mysqldb
The following message will be used for the patch API method.
{"name": "mysqldb", "project": "myproject", "settings": {}}
Patching Cloud SQL instance...done.
Updated [https://sqladmin.googleapis.com/sql/v1beta4/projects/myproject/instances/mysqldb].
It didn't upgrade, so I restarted the MySQL instance, and even after that the version remained 8.0.26.
This is expected because when you execute gcloud sql instances patch mysqldb this will do nothing about an upgrade because actually you're not setting what to patch.
If you look at the body sent to the API it is almost "empty"
{"name": "mysqldb", "project": "myproject", "settings": {}}
Moreover, in the docs you link it mentions that to upgrade the instance you should specify the new version.
gcloud sql instances patch mysqldb --database-version=MYSQL_8_0_29
which results in
{"databaseVersion": "MYSQL_8_0_29", "name": "mysqldb", "project": "myproject", "settings": {}}

Why npm run serve is throwing ERR_OSSL_EVP_UNSUPPORTED? [duplicate]

This question already has answers here:
Error message "error:0308010C:digital envelope routines::unsupported"
(50 answers)
Closed 12 months ago.
I'm having an issue with a Webpack build process that suddenly broke, resulting in the following error...
<s> [webpack.Progress] 10% building 0/1 entries 0/0 dependencies 0/0 modules
node:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at BulkUpdateDecorator.hashFactory (/app/node_modules/webpack/lib/util/createHash.js:155:18)
at BulkUpdateDecorator.update (/app/node_modules/webpack/lib/util/createHash.js:46:50)
at OriginalSource.updateHash (/app/node_modules/webpack-sources/lib/OriginalSource.js:131:8)
at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:888:17)
at handleParseResult (/app/node_modules/webpack/lib/NormalModule.js:954:10)
at /app/node_modules/webpack/lib/NormalModule.js:1048:4
at processResult (/app/node_modules/webpack/lib/NormalModule.js:763:11)
at /app/node_modules/webpack/lib/NormalModule.js:827:5 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
command terminated with exit code 1
I've tried googling ERR_OSSL_EVP_UNSUPPORTED webpack which yielded almost no useful results, but it did highlight an issue using MD4 as provided by OpenSSL (which is apparently deprecated?) to generate hashes.
The webpack.config.js code is as follows:
const path = require('path');
const webpack = require('webpack');
/*
* SplitChunksPlugin is enabled by default and replaced
* deprecated CommonsChunkPlugin. It automatically identifies modules which
* should be splitted of chunk by heuristics using module duplication count and
* module category (i. e. node_modules). And splits the chunks…
*
* It is safe to remove "splitChunks" from the generated configuration
* and was added as an educational example.
*
* https://webpack.js.org/plugins/split-chunks-plugin/
*
*/
/*
* We've enabled TerserPlugin for you! This minifies your app
* in order to load faster and run less javascript.
*
* https://github.com/webpack-contrib/terser-webpack-plugin
*
*/
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'development',
entry: './src/js/scripts.js',
output: {
path: path.resolve(__dirname, 'js'),
filename: 'scripts.js'
},
devtool: 'source-map',
plugins: [new webpack.ProgressPlugin()],
module: {
rules: []
},
optimization: {
minimizer: [new TerserPlugin()],
splitChunks: {
cacheGroups: {
vendors: {
priority: -10,
test: /[\\/]node_modules[\\/]/
}
},
chunks: 'async',
minChunks: 1,
minSize: 30000,
name: 'true'
}
}
};
How do I change the hashing algorithm used by Webpack to something else?
I was able to fix it via:
export NODE_OPTIONS=--openssl-legacy-provider
sachaw's comment to Node.js v17.0.0 - Error starting project in development mode #30078
But they say they fixed it: ijjk's comment to Node.js v17.0.0 - Error starting project in development mode #30078:
Hi, this has been updated in v11.1.3-canary.89 of Next.js, please update and give it a try!
For me, it worked only with the annotation above.
I also want to point out that npm run start works with -openssl-legacy-provider, but npm run dev won't.
It seems that there is a patch:
Node.js 17: digital envelope routines::unsupported #14532
I personally downgraded to 16-alpine.
I had this problem too. I'd accidentally been running on the latest Node.js (17.0 at time of writing), not the LTS version (14.18) which I'd meant to install. Downgrading my Node.js install to the LTS version fixed the problem for me.
There is a hashing algorithm that comes with Webpack v5.54.0+ that does not rely on OpenSSL.
To use this hash function that relies on a npm-provided dependency instead of an operating system-provided dependency, modify the webpack.config.cjs output key to include the hashFunction: "xxhash64" option.
module.exports = {
output: {
hashFunction: "xxhash64"
}
};
Ryan Brownell's answer is the ideal solution if you are using Webpack v5.54.0+.
If you're using an older version of Webpack, you can still solve this by changing the hash function to one that is not deprecated. (It defaults to the ancient md4, which OpenSSL has removed support for, which is the root cause of the error.) The supported algorithms are any supported by crypto.createHash. For example, to use SHA-256:
module.exports = {
output: {
hashFunction: "sha256"
}
};
Finally, if you are unable to change the Webpack configuration (e.g., if it's a transitive dependency which is running Webpack), you can enable OpenSSL's legacy provider to temporarily enable MD4 during the Webpack build. This is a last resort. Create a file openssl.cnf with this content…
openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
[provider_sect]
default = default_sect
legacy = legacy_sect
[default_sect]
activate = 1
[legacy_sect]
activate = 1
…and then set the environment variable OPENSSL_CONF to the path to that file when running Webpack.
It is not my answer really, but I found this workaround /hack/ to fix my problem Code Check in for a GitHub project... see the bug comments here.
I ran into ERR_OSSL_EVP_UNSUPPORTED after updating with npm install.
I added the following to node_modules\react-scripts\config\webpack.config.js
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
I tried Ryan Brownell's solution and ended up with a different error, but this worked...
This error is mentioned in the release notes for Node.js 17.0.0, with a suggested workaround:
If you hit an ERR_OSSL_EVP_UNSUPPORTED error in your application with Node.js 17, it’s likely that your application or a module you’re using is attempting to use an algorithm or key size which is no longer allowed by default with OpenSSL 3.0. A command-line option, --openssl-legacy-provider, has been added to revert to the legacy provider as a temporary workaround for these tightened restrictions.
I ran into this issue using Laravel Mix (Webpack) and was able to fix it within file package.json by adding in the NODE_OPTIONS=--openssl-legacy-provider (referenced in Jan's answer) to the beginning of the script:
package.json:
{
"private": true,
"scripts": {
"production": "cross-env NODE_ENV=production NODE_OPTIONS=--openssl-legacy-provider node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
...
}
}
Try upgrading your Webpack version to 5.62.2.
I faced the same challenge, but you just need to downgrade Node.js to version 16.13 and everything works well. Download LTS, not the current on Downloads.
I had the same problem with my Vue.js project and I solved it.
macOS and Linux
You should have installed NVM (Node Version Manager). If you never had before, just run this command in your terminal:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
Open your project
Open the terminal in your project
Run the command nvm install 16.13.0 or any older version
After the installation is completed, run nvm use 16.13.0
I faced the same problem in a project I developed with Next.js. For the solution, I ran the project as follows and I solved the problem.
cross-env NODE_OPTIONS='--openssl-legacy-provider' next dev
This means that you have the latest Node.js version. If you are using it for Docker then you need to change the image from
FROM node
to
FROM node:14

Configuring Apache drill for Cassandra

I am trying to configure Cassandra with Drill. I used the same approach given on the link: https://drill.apache.org/docs/starting-the-web-ui/.
I used the following code for New Storage Plugin:
{
"type": "cassandra",
"hosts": [
"127.0.0.1"
],
"port": 9042,
"username": "<username>",
"password": "<password>",
"enabled": false
}
I have attached the Screenshot here.
But I'm getting the following error:
Please retry: Error (invalid JSON mapping)
How can I resolve this?
All the code :
Git: https://github.com/yssharma/drill/tree/cassandra-storage
Patch: https://gist.github.com/yssharma/2581ae8a97c559b2677f
1. Get Drill: Lets get the Drill source
$ git clone https://github.com/apache/drill.git
2. Get Cassandra Storage patch/Download the Patch file from:
https://reviews.apache.org/r/29816/diff/raw/
3. Apply the patch on top of Drill
$ cd drill
$ git apply --check ~/Downloads/DRILL-92-CassandraStorage.patch
$ git apply ~/Downloads/DRILL-92-CassandraStorage.patch
4. Build Drill with Cassandra Storage & export distribution to /opt/drill
$ mvn clean install -DskipTests
$ mkdir /opt/drill
$ tar xvzf distribution/target/*.tar.gz --strip=1 -C /opt/drill
5. Start Sqlline.
That it we have finished with the Drill build and installation – and its time we can start using Drill.
$ cd /opt/drill
$ bin/sqlline -u jdbc:drill:zk=local -n admin -p admin
Drill-Sqlline
Hit ‘show schemas‘ to view existing schemas.
Drill-Sqlline-schemas
6. Drill Web interface
You should be able to see the Drill web interface on localhost:8047, or whatever your host/port is.
Use this as your config:
{
"type": "cassandra",
"config": {
"cassandra.hosts": [
"127.0.0.1",
"127.0.0.2"
],
"cassandra.port": 9042
},
"enabled": true
}
Also, if this doesnt work, know that they are working on a plugin for it now: https://github.com/apache/drill/pull/1960
I'll give an update here as well. We're doing some serious refactoring of the how Drill works with storage plugins. Specifically, we're working to incorporate the Calcite Adapter1 for Cassandra. The reason for this is that the hard part of storage plugins isn't the connection, it's the optimizations. Calcite already does query planning for Drill and already implemented a bunch of these adapters which means that the work of figuring out all the optimizations (AKA pushdowns) is largely done.
In the case of Cassandra/Scylla, this is particularly important because some filters should be pushed down to Cassandra, and some should absolutely not be pushed down. The adapters also include aggregate pushdowns--something which no Drill plugins currently do. Again the point of this is that once we commit this, the connector should work VERY will with Cassandra/Scylla. We have one for ElasticSearch that is very near completion and once that's done the Cassandra plugin is next. If you have any suggestions/comments or other feedback, please post on the pull request linked above.
** UPDATE 11 April 2021: Cassandra/Scylla Plugin Now Merged in Drill 1.19.0-SNAPSHOT **

Autodesk Forge RCDB Deployment to Heroku

Can someone give me a step by step! guide to deploying all the work at https://github.com/Autodesk-Forge/forge-rcdb.nodejs - to Heroku or Digital Ocean? I'm fine with either, but I'd like a proper guide here for anyone else that tries to go through this.
Explanation:
Following the guide here # Building Autodesk Forge RCDB on Windows 10 fails with node-gyp errors - I created my own DB on my localhost. I had no choice but to change the dynamic clientsecret and clientid in development.config.js to a static option - using the ones in my own forge api get it working.
Issues:
https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process
Log In: I get the following error if I click on login to my forge account from the website (LINK)
I've moved all of my files to heroku, hosted my database (though have not even gotten to the point of testing that far). When I try to build on heroku I get the following error.
-----> Node.js app detected
-----> Build failed
Two different lockfiles found: package-lock.json and yarn.lock
Both npm and yarn have created lockfiles for this application,
but only one can be used to install dependencies. Installing
dependencies using the wrong package manager can result in missing
packages or subtle bugs in production.
- To use npm to install your application's dependencies please delete
the yarn.lock file.
$ git rm yarn.lock
- To use yarn to install your application's dependences please delete
the package-lock.json file.
$ git rm package-lock.json
https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-conflicting-lock-files
Push rejected, failed to compile Node.js app.
Push failed
Log In: I get the following error if I click on login to my forge account from the website (LINK)
You need to configure the following environment variables on Heroku (the lack of FORGE_CLIENT_ID as the environment variable was what caused the error):
"NODE_ENV": {
"description": "Environment, defaulted to production",
"value": "production"
},
"NPM_CONFIG_PRODUCTION": {
"description": "This forces Heroku to install devDependencies, needed to build the App. Must be false!",
"value": "false"
},
"FORGE_CLIENT_ID": {
"description": "Your Forge Client ID API Key"
},
"FORGE_CLIENT_SECRET": {
"description": "Your Forge Client Secret API Key"
},
"RCDB_DBHOST": {
"description": "Database host url"
},
"RCDB_PORT": {
"description": "Database port"
},
"RCDB_DBNAME": {
"description": "Database name"
},
"RCDB_USER": {
"description": "Database username"
},
"RCDB_PASS": {
"description": "Database user password"
}
This should have been easier with the Deploy to Heroku button in the project README but it's not set up right unfortunately.
I've moved all of my files to heroku, hosted my database (though have not even gotten to the point of testing that far). When I try to build on heroku I get the following error.
As is suggested in the error messages only one package manager should be present so either delete the yarn.lock or package-lock.json file in the root directory of the project and deploy again.

Mysql ER_BAD_FIELD_ERROR on findOne with loopback

I am currently building a webapp using AngularJS, Loopback and MySQL. It worked fined for a while and recently most of the request I made to loopback from my front-end started to fail with an internal server error.
Error: ER_BAD_FIELD_ERROR: Unknown column 'scopes' in 'field list'
I am using the Loopback Angular SDK to make my request in my frontend. I don't really understand why it is searching for a column scopes since i call it to search for a user when I have its id.
$scope.user = !$scope.isLoggedIn ? {} : Appuser.findOne({
filter: {
where: { id: Appuser.getCurrentId() }
}
}).$promise.then(function(res){
$scope.user = res;
});
I recently started to use webpack on this app and also recently reinstalled all of my node modules and I don't know if it may have had an impact but I suspect so because when I'm reverting to commits at a time it all worked fined the problem still happen. However since I'm using npm and a package.json for my modules I don't understand what could have gone wrong.
I solved it do below (I'm using mysql connector)
ALTER TABLE AccessToken ADD COLUMN `scopes` TEXT NULL;
I found new field at ./node_modules/loopback/common/models/access-token.json.
"scopes": {
"type": ["string"],
"description": "Array of scopes granted to this access token."
}
After some more research, I found an answer. It was a problem with npm that installed the wrong version of loopback because I did not fix my dependencies versions number and had "loopback": "^3.0.0" when I needed "loopback": "3.0.0",.
The ^ mean that npm may take a more recent minor version which in my case happened and totally broke my connection with my database.
If it ever happens with anyone else don't forget to delete and reinstall your node modules afterward.