blog.iwanluijks.nl
IL

Running PM2 5.3.1 as a non-root started service by systemd

· Labeled under: selinux, pm2, nodejs.

NodeJS... So there are various process managers available that are developed specifically to provide high availability for NodeJS (or NextJS for that matter) applications. One of those process managers is PM2. Running PM2 as a non-root user is not so easy though and requires several…

Using a custom GNU Assembler version for GCC on OpenBSD 7.3

· Labeled under: openbsd, nodejs.

When building NodeJS on OpenBSD you will likely run into the problem of the GNU Assembler (read gas) version being outdated and passing on --openssl-no-asm to the configure script. You can't pass along the --with-as option to the configure script for NodeJS as it will…

Pushing GraphQL errors from API Platform to Sentry

· Labeled under: sentry, php, apiplatform.

By default errors resulting from GraphQL calls done to API Platform don't end up in Sentry. Use the following piece of code and configuration to make sure they will be send to Sentry. namespace MyNamespace; use ApiPlatform\GraphQl\Error\ErrorHandlerInterface; use GraphQL\Error\Error; use Sentry\State\HubInterface; class ErrorHandler implements ErrorHandlerInterface…

API Platform custom collection filter on identifier

· Labeled under: php, apiplatform.

API Platform supports various filters out of the box, like the SearchFilter. The filters though lack support for filtering on an entity's id when using another property as the identifier of the entity. Given you have for example the field ext_ref marked as identifier of the…

API Platform State Providers, Query extensions and Resolvers

· Labeled under: php, doctrine, apiplatform.

API Platform provides a bunch of interfaces to customize and extend your API to your own wishes. Some interfaces or the logic behind them might be quite confusing though. Let`s clear some things up in here. State Providers, Data Providers or simply Providers, however you…

Efficient Doctrine entity iteration

· Labeled under: php, doctrine.

There are a ton of ways described online to iterate entities efficiently in Doctrine 2.* (up to at least 2.17), but the most efficient one is definitely to lookup entities using your own for loop. <?php ... $maxLimit = 100_000; $limit = 200; $offset =…

Gedmo Sluggable SlugHandler fix when using native attributes vs annotations

· Labeled under: none.

When you have a SlugHandler defined on a property as annotation, take note that when converting those kind of annotations to attributes (even when using RectorPHP) the SlugHandler for the Gedmo library requires using a separate attribute when applicable (besides the Slug attribute, again, when…

Mails sent using Mailgun over SMTP don`t seem to come through

· Labeled under: php.

If you find yourself having trouble sending mails using Mailgun over SMTP, try to use port 2525.

Installed API Platform 2.7 and resources not found?

· Labeled under: php, apiplatform.

When installing API Platform using Composer with composer req api for example and you get version 2.7 installed make sure that when following the documentation of API Platform (having ApiPlatform\Metadata\ApiResource as attribute) you also put the directive metadata_backward_compatibility_layer: false under api_platform in api/config/packages/api_platform.yaml otherwise your resources won't be…