Skip to content

fix: remove noisy implicit configuration warning from service locator#3837

Merged
barjin merged 4 commits into
v4from
3582-remove-implicit-configuration-warning
Jul 21, 2026
Merged

fix: remove noisy implicit configuration warning from service locator#3837
barjin merged 4 commits into
v4from
3582-remove-implicit-configuration-warning

Conversation

@barjin

@barjin barjin commented Jul 9, 2026

Copy link
Copy Markdown
Member

Fixes #3582.

ServiceLocator.getEventManager()/getStorageClient() logged a warning about implicit Configuration creation any time it happened before an explicit setConfiguration() call. That's the normal path for basic usage (nobody sets Configuration explicitly by default), so the warning showed up as the first log line in even a blank crawler template, which reads as if something in the setup is wrong when it isn't.

Removed the warning; the existing debug log already records that a default was created, and the genuine conflict case (implicit creation followed by a later setConfiguration() call) still throws a clear ServiceConflictError.

The warning fired on every default-configuration usage (e.g. a blank
CheerioCrawler), not just the rare case where it would actually matter,
confusing beginners into thinking something changed about the expected
setup. The debug log already records that a default was created; the
actual conflict case is still surfaced via ServiceConflictError if it
occurs.

Closes #3582

# Conflicts:
#	packages/core/src/service_locator.ts
@barjin
barjin force-pushed the 3582-remove-implicit-configuration-warning branch from d9f5023 to 99c8cc3 Compare July 21, 2026 11:38
@janbuchar

Copy link
Copy Markdown
Contributor

This behavior is modelled after crawlee-python (pretty much verbatim), so it weirded me out that the JS version logs the warning in a bare-bones project and the Python version doesn't.

The reason is that crawlee-python's BasicCrawler actually pre-populates configuration in the constructor.

I'd argue that this is a better fix — the warning might be legit if you manipulate the service locator directly.

…g the warning

Restores the implicit-configuration warnings in ServiceLocator (they still
matter if the service locator is manipulated directly) and instead mirrors
crawlee-python's BasicCrawler, which resolves the configuration up front in
its constructor before the storage client/event manager are ever created.
Doing the same in BasicCrawler means the warning no longer fires for the
common blank-crawler case, since configuration is already set by the time
anything implicitly requests a storage backend or event manager.
Comment thread packages/basic-crawler/src/internals/basic-crawler.ts Outdated
@barjin
barjin merged commit 7b0a5b1 into v4 Jul 21, 2026
8 checks passed
@barjin
barjin deleted the 3582-remove-implicit-configuration-warning branch July 21, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants