Mongo 2.4.1 upgrade causing Fatal error: Class 'Doctrine\MongoDB\Util\InvalidArgumentException' not found - mongodb

I had everything working and I upgraded my mac ports on my mac to get the latest packages. It installed Mongo 2.4.1 and I also got boost #1.53.0_1+no_single+no_static+python27. Now when I try interfacing using the same code in my Symfony 2 application, I get :
Fatal error: Class 'Doctrine\MongoDB\Util\InvalidArgumentException' not found in /Users/saudfaisal/Sites/dailytamatar.com/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Util/ReadPreference.php on line 63
my composer.json looks like the following:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*#dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"friendsofsymfony/user-bundle": "*",
"friendsofsymfony/rest-bundle": "*",
"jms/serializer-bundle": "*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
"doctrine/mongodb-odm-bundle": "3.0.*#dev"
}, "minimum-stability": "stable",
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
I know in the past there was an issue with boost and one had to roll back to boost #1.49.0_0 however that did not work this time.
Can someone help me please?

This was fixed in version 1.0.2 of the doctrine/mongodb package, which was released a few months ago. The actual commit is b317c8e if you'd like to confirm.
I would suggest explicitly requiring doctrine/mongodb-odm and possibly doctrine/mongodb in your composer.json file, instead of rely on the bundle's internal dependency. Additionally, it's likely that your composer.lock file is pointing to an outdated release of doctrine/mongodb that still satisfies the version requirement for ODM. In that case, you'll want to upgrade your dependencies (via composer upgrade), which should also upgrade your lock file and the version/commit points therein.

Related

CI Using Azure Pipelines and Nx fails

UPDATE: I was able to get this working by setting "ProduceReferenceAssembly" to false in the .csproj files of the libs. Not sure if this is optimal or intended but that is what worked for me. See: Ref folder within .NET 5.0 bin folder
I'm trying to set up a proof of concept using NX dot net and Azure using this exaple .yml: https://nx.dev/recipes/ci/monorepo-ci-azure
I have 3 services (libs) and 3 apis (apps) ... I made a change to one of the apis to test caching and incremental builds.
The unchanged projects all say [remote cache] but then the build fails because it's looking for the .dlls in the /obj/Debug/ directory. Why use that when there are .dlls in the /dist directory?
How can I fix this? Is there something in the nx.json or project.json files I need to change?
(https://i.stack.imgur.com/IQhaO.png)
I tried using the same command locally on my machine and it completes as expected. I expect the build to complete. The build fails when remote caching is used.
{
"name": "ShipmentService",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/ShipmentService",
"targets": {
"build": {
"executor": "#nx-dotnet/core:build",
"outputs": [
"{workspaceRoot}/dist/libs/ShipmentService",
"{workspaceRoot}/libs/ShipmentService/obj"
],
"options": {
"configuration": "Debug",
"noDependencies": true
},
"configurations": {
"production": {
"configuration": "Release"
}
}
},
"lint": {
"executor": "#nx-dotnet/core:format"
}
},
"tags": []
}
Tried proposed workaround, here's what I'm noticing: platformservice:build [remote cache]
Error, it sees the intermediates part, but basically same issue: same error
Updated project.json (all of them have been updated to look similar to this [tried with and without /obj portion]):
"outputs": [
"{workspaceRoot}/dist/libs/ShipmentService",
"{workspaceRoot}/dist/intermediates/libs/ShipmentService/obj"
],
This is a bug on nx-dotnet's side, and we aren't quite capturing all of the outputs that are needed for the cache. If you add the path to the obj directory into the outputs array of the build target in project.json it should work. Here's the workaround which will eventually be migrated:
I've got a branch with this working, you do indeed need the obj directory as part of the cache. There are some weird intricacies with this though. I'll work on a migration + patch. In the meantime, the workaround that I used is:
Update Directory.Build.props adding these to the property group containing the output path manipulation:
<BaseIntermediateOutputPath>$(RepoRoot)dist/intermediates/$(ProjectRelativePath)/obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
As an example, the full file looks like this on the nx-dotnet repo now:
<Project>
<PropertyGroup>
<!-- Output path configuration -->
<RepoRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</RepoRoot>
<ProjectRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</ProjectRelativePath>
<BaseOutputPath>$(RepoRoot)dist/$(ProjectRelativePath)</BaseOutputPath>
<OutputPath>$(BaseOutputPath)</OutputPath>
<BaseIntermediateOutputPath>$(RepoRoot)dist/intermediates/$(ProjectRelativePath)/obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup>
<RestorePackagesWithLockFile>false</RestorePackagesWithLockFile>
</PropertyGroup>
</Project>
Your project.json file should look something like this now:
{
"name": "demo-webapi",
"sourceRoot": "demo/apps/webapi",
"targets": {
"build": {
"executor": "#nx-dotnet/core:build",
"outputs": [
"{workspaceRoot}/dist/demo/apps/webapi",
"{workspaceRoot}/dist/intermediates/demo/apps/webapi"
],
"options": {
"configuration": "Debug",
"noDependencies": true
},
"configurations": {
"production": {
"configuration": "Release"
}
}
}
}
}

How can I bundle MONGODB?

I'm try to bundle with browserify when I try
browserify index.js > main.js
I get this error
Error: Can't walk dependency graph: Cannot find module 'mongodb-client-encryption' from '/home/xlrnz/Documenti/simple-crud/node_modules/mongodb/lib/operations/connect.js'
required by /home/xlrnz/Documenti/simple-crud/node_modules/mongodb/lib/operations/connect.js
at /usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:116:35
at processDirs (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:269:39)
at isdir (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:276:32)
at /usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:25:69
at FSReqCallback.oncomplete (node:fs:194:21)
I can't understand. This is index.js:
const dotenv = require("dotenv").config();
const monk = require("monk");
const db = monk(
`mongodb+srv://simple-crud-xlrnz:${process.env.MONGO_DB_KEY}#simple-crud.jrjfl.mongodb.net/simple-crud-DB?retryWrites=true&w=majority`
);
and this is package-json:
{
"name": "simple-crud",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "",
"license": "ISC",
"devDependencies": {
"dotenv": "^8.2.0",
"nodemon": "^2.0.7"
},
"dependencies": {
"monk": "^7.3.3"
}
}
I'm stuck here for about 2hours anyone can help?
The client encryption module being referenced in your error message requires spawning a process which cannot be done from the browser. I am not very familiar with browserification but if you can configure it to ignore this module you might succeed with browserifying.
With that said, as pointed out in the comments, generally nobody would connect directly to a MongoDB server from the browser. The closest sensible alternative is MongoDB Realm/Stitch. So the thing you are trying to do is basically not supported.
There are many MongoDB tutorials out there, I suggest following one of them.

TYPO3 CMS 8.7.27: Call to a member function getPackagePath() on null

After installing extensions in typo3 CMS 8.7.27, I got following error.. Seems like the ExtensionManagementUtility can't load the ah_contentapi.
This is my composer.json file in root (/var/www/html/typo3) for loading my extensions:
{
"repositories":[
{
"type":"composer",
"url":"https://composer.typo3.org/"
},
{
"type":"package",
"package":{
"name":"Bm/ah-content-api",
"version":"0.0.1",
"type":"typo3-cms-extension",
"source":{
"url":"https://user#bitbucket.org/company/ah_config_typo3.git",
"type":"git",
"reference":"master"
}
}
},
{
"type":"package",
"package":{
"name":"Bm/ah-contentelements",
"version":"0.0.1",
"type":"typo3-cms-extension",
"source":{
"url":"https://user#bitbucket.org/company/ah_contentelements_typo3.git",
"type":"git",
"reference":"master"
}
}
}
],
"name":"typo3/cms-base-distribution",
"description":"TYPO3 CMS Base Distribution",
"license":"GPL-2.0-or-later",
"require":{
"helhum/typo3-console":"^4.9.3 || ^5.2",
"typo3/cms-about":"^8.7.10",
"typo3/cms-belog":"^8.7.10",
"typo3/cms-beuser":"^8.7.10",
"typo3/cms-context-help":"^8.7.10",
"typo3/cms-documentation":"^8.7.10",
"typo3/cms-felogin":"^8.7.10",
"typo3/cms-fluid-styled-content":"^8.7.10",
"typo3/cms-form":"^8.7.10",
"typo3/cms-func":"^8.7.10",
"typo3/cms-impexp":"^8.7.10",
"typo3/cms-info":"^8.7.10",
"typo3/cms-info-pagetsconfig":"^8.7.10",
"typo3/cms-rte-ckeditor":"^8.7.10",
"typo3/cms-setup":"^8.7.10",
"typo3/cms-sys-note":"^8.7.10",
"typo3/cms-t3editor":"^8.7.10",
"typo3/cms-tstemplate":"^8.7.10",
"typo3/cms-viewpage":"^8.7.10",
"typo3/cms-wizard-crpages":"^8.7.10",
"typo3/cms-wizard-sortpages":"^8.7.10",
"typo3/cms":"^8.7",
"dmitryd/typo3-realurl":"2.*",
"GridElementsTeam/Gridelements":"8.2.*",
"clickstorm/cs_seo":"3.*",
"Bm/ah-content-api":"0.0.1",
"Bm/ah-contentelements":"0.0.1"
},
"scripts":{
"typo3-cms-scripts":[
"typo3cms install:fixfolderstructure",
"typo3cms install:generatepackagestates"
],
"post-autoload-dump":[
"#typo3-cms-scripts"
]
},
"extra":{
"typo3/cms":{
"web-dir":"public"
},
"helhum/typo3-console":{
"comment":"This option is not needed ay more for helhum/typo3-console 5.x",
"install-extension-dummy":false
}
},
"autoload":{
"psr-4":{
"Bm\\AhContentelements\\":"public/typo3conf/ext/ah_contentelements/Classes",
"Bm\\AhContentapi\\":"public/typo3conf/ext/ah_content_api/Classes"
}
}
}
I already cleared cache in install tool at:
1. -> important actions -> clear all cache
2. -> clean up -> Clean typo3temp/ folder
piece from composer.lock:
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is #generated automatically"
],
"content-hash": "954afd2318d54ec9b1dd0e4d7f9b445b",
"packages": [
{
"name": "Bm/ah-content-api",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://stevenhippovibe#bitbucket.org/hippovibe/ah_config_typo3.git",
"reference": "master"
},
"type": "typo3-cms-extension"
},
{
"name": "Bm/ah-contentelements",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://stevenhippovibe#bitbucket.org/stevenhippovibe/ah_contentelements_typo3.git",
"reference": "master"
},
"type": "typo3-cms-extension"
},
The Error occurs when the extension folder name under typo3conf/ext/<folder_name> doesn't match extension key used in some places of the system (e.g. using EXT:your_extension_key/... syntax in TypoScript).
Changing folder name fixed similar problem for me.
Check the PHP version and try to change it from i.e. 7.4 to 7.3.
I once had this problem with an extension that should be compatible with PHP 7.4, but wasn't in real life. This solved the problem for me.
Question here is:
How did you update to 8.7.27 (which composer command was executed)
How does your composer.lock look like?
Do you use TYPO3 console or any other special composer plugins / CLI commands to e.g. generate PackageStates.php?
I just ran into the same error message under TYPO3 9.5.5.
Solution:
Deinstall one TYPO3 extension after the other and try it out again. This will lead you to the extension which has an error. Most probably the error is inside of the file ext_localconf.php or ext_tables.php .
I got this error detail:
PHP Warning: Use of undefined constant FH_DEBUG_EXT - assumed 'FH_DEBUG_EXT' (this will throw an Error in a future version of PHP) in /var/www/html/global-extensions/ext/div2007/ext_localconf.php line 15
This has nothing to do with your error. But it can be that you have an error in one of your installed extensions or even in a backup of an extension, e.g. a folder named as extensionname.bak .
Also these recommendations can help:
https://wiki.typo3.org/Exception/CMS/1476107295

How can I target .NET35 on OSX using mono and dnx/dnvm?

on Windows using Visual Studio 2015, I can compile a project with dnu build.
The project.json file looks as follows:
{
"version": "1.0.0-*",
"description": "My Class Library",
"authors": [ "Class Library template" ],
"tags": [""],
"projectUrl": "",
"licenseUrl": "",
"tooling": {
"defaultNamespace": "Common"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-*",
"System.Collections": "4.0.11-beta-*",
"System.Linq": "4.0.1-beta-*",
"System.Runtime": "4.0.21-beta-*",
"System.Threading": "4.0.11-beta-*"
}
}
}
}
After installing mono, dnvm and dnx on a Mac, as per this tutorial, I can actually compile the same project on OSX! This in itself is already pretty awesome!
now, I added the following framework to my project.json file:
"frameworks": {
"dnx35": { }, //"net35"
"dnx451": { },
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-*",
"System.Collections": "4.0.11-beta-*",
"System.Linq": "4.0.1-beta-*",
"System.Runtime": "4.0.21-beta-*",
"System.Threading": "4.0.11-beta-*"
}
}
This still compiles on Windows, and produces three sets of dlls, as expected.
However, on OSX it does not build the dnx20 target. Though as far as I understand, the mono compiler mcs can be set to target .net35 by passing in a sdk parameter.
So my question is: Can I target .NET35 with dnx on OSX using mono?
EDIT
The goal of this question is to compile a set of dll's that can be imported into Unity3d. And because Unity3d uses mono as a runtime, I would like to be able to do that by using dnu build, as to be able to develop these dll's on any platform.
You can pass custom Rosyln compiler options via compilationOptions in the project.json file:
"compilationOptions": {
"optimize": true,
"define": ["RELEASE", "TRACE", "PLAYSCRIPT"]
},
Take a look at the various project.json files in the Github aspnet/dnx project, i.e. project.json
But those options are being passed to Rosyln not mcs, Mono is being used as a CLR host for Rosyln's compiler as a service), but I do not believe you are substitute Mono's mcs for that (comments on this anyone?)

Which DoctrineBundle version works with Symfony 2.0.15?

I've spent days now trying to sort out my deps in Symfony 2.0.15. I can't find a compatible list of bundles and I've been chasing commits around github trying to follow a chain of non-BC changes to get a list of versions that works for me. Eventually I chose to give up and upgraded to composer, only to find that some of the Doctrine core requires Symfony 2.1, yet some of the other Doctrine bundles require Symfony <2.1 and eventually I gave up on that as well.
Can someone with the following Bundles installed please let me know what stable versions they are using from their deps.lock?
[symfony]
git=http://github.com/symfony/symfony.git
version=v2.0.15
[twig]
git=http://github.com/fabpot/Twig.git
version=v1.8.2
[monolog]
git=http://github.com/Seldaek/monolog.git
version=1.0.2
[doctrine-common]
git=http://github.com/doctrine/common.git
version=2.1.4
[doctrine-dbal]
git=http://github.com/doctrine/dbal.git
version=2.1.7
[doctrine]
git=http://github.com/doctrine/doctrine2.git
version=2.1.7
[swiftmailer]
git=http://github.com/swiftmailer/swiftmailer.git
version=v4.1.7
[assetic]
git=http://github.com/kriswallsmith/assetic.git
version=cc2e9adb744df0704a5357adc1cf9287c427420f
[twig-extensions]
git=http://github.com/fabpot/Twig-extensions.git
[metadata]
git=http://github.com/schmittjoh/metadata.git
version=1.0.0
[SensioFrameworkExtraBundle]
git=http://github.com/sensio/SensioFrameworkExtraBundle.git
target=/bundles/Sensio/Bundle/FrameworkExtraBundle
version=origin/2.0
[JMSSecurityExtraBundle]
git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
target=/bundles/JMS/SecurityExtraBundle
version=origin/1.0.x
[SensioDistributionBundle]
git=http://github.com/sensio/SensioDistributionBundle.git
target=/bundles/Sensio/Bundle/DistributionBundle
version=origin/2.0
[SensioGeneratorBundle]
git=http://github.com/sensio/SensioGeneratorBundle.git
target=/bundles/Sensio/Bundle/GeneratorBundle
version=origin/2.0
[AsseticBundle]
git=http://github.com/symfony/AsseticBundle.git
target=/bundles/Symfony/Bundle/AsseticBundle
version=v1.0.1
[doctrine-mongodb]
git=http://github.com/doctrine/mongodb.git
[doctrine-mongodb-odm]
git=http://github.com/doctrine/mongodb-odm.git
[DoctrineMongoDBBundle]
git=http://github.com/doctrine/DoctrineMongoDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
version=v2.0.1
[DoctrineMigrationsBundle]
git=https://github.com/doctrine/DoctrineMigrationsBundle.git
target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle
version=origin/2.0
[doctrine-migrations]
git=http://github.com/doctrine/migrations.git
[doctrine-fixtures]
git=http://github.com/doctrine/data-fixtures.git
[DoctrineFixturesBundle]
git=https://github.com/doctrine/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
version=origin/2.0
[DoctrineBundle]
git=http://github.com/doctrine/DoctrineBundle.git
target=/bundles/Doctrine/Bundle/DoctrineBundle
[FOSJsRoutingBundle]
git=http://github.com/FriendsOfSymfony/FOSJsRoutingBundle.git
target=/bundles/FOS/JsRoutingBundle
[GedmoDoctrineExtensions]
git=http://github.com/l3pp4rd/DoctrineExtensions.git
target=/gedmo-doctrine-extensions
[StofDoctrineExtensionsBundle]
git=http://github.com/stof/StofDoctrineExtensionsBundle.git
target=/bundles/Stof/DoctrineExtensionsBundle
With these combinations I get a constant set of errors due to classes not existing or renamed methods, which I then look up in the github repositories and try to fix to a commit/tag which resolves this error, only to get another set of errors because of other classes not existing or renamed methods. I can't go back to the stable state I had a few weeks ago because of the namespace changes to the Doctrine organisation - (#see What happened to Doctrine's Symfony Bundle repos?)
Alternatively I don't mind switching to composer; heres the composer.json that I tried, but doesn't work
{
"require": {
"symfony/symfony" : "v2.0.15",
"symfony/doctrine-bridge": "2.1.x-dev",
"doctrine/common" : "2.1.4",
"doctrine/orm" : "2.1.6",
"symfony/finder" : "v2.0.15",
"symfony/assetic-bundle" : "2.0.x-dev",
"twig/extensions" : "dev-master",
"jms/security-extra-bundle" : "1.0.x",
"sensio/framework-extra-bundle" : "2.0.x-dev",
"sensio/distribution-bundle" : "2.0.x-dev",
"sensio/generator-bundle" : "2.0.x-dev",
"doctrine/doctrine-bundle": "v1.0.0-beta1",
"doctrine/mongodb-odm-bundle": "v2.0.1",
},
"autoload": {
"psr-0": {
"Oh": "src/"
}
}
}
Whenever I try to fix dependencies in the composer.json I seem to get in a cycle of upgrading and degrading the same packages over and over again but always getting the error "Your requirements could not be solved to an installable set of packages.". If someone could provide me with their composer.json setup using Symfony 2.0.15 with the Doctrine,MongoDB,DoctrineFixtures and DoctrineMigrations bundles I'd be most grateful.
Here's part of my working composer configuration:
{
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.0.15",
"doctrine/orm": "2.1.7",
"twig/extensions": "*",
"symfony/assetic-bundle": "2.0.x-dev",
"sensio/generator-bundle": "2.0.*",
"sensio/framework-extra-bundle": "2.0.*",
"jms/security-extra-bundle": "1.0.*",
"stof/doctrine-extensions-bundle": "*",
"doctrine/doctrine-migrations-bundle": "2.0.*"
}
}
I'm not using ODM though.