[RTFACT-9126] NPM remote that is offline still fetches metadata from remote Created: 28/Jan/16  Updated: 14/Nov/17  Resolved: 20/Jun/16

Status: Resolved
Project: Artifactory Binary Repository
Component/s: NPM
Affects Version/s: 4.4.2
Fix Version/s: 4.9.0

Type: Bug Priority: Normal
Reporter: Aaron Rhodes Assignee: Shay Bagants
Resolution: Fixed Votes: 0
Labels: None

Assigned QA: Mor Iluz (Inactive)

 Description   

Steps to reproduce:

1) Create npm local, remote and virtual repos
2) Install some packages using npm
3) Set the npm-remote repo to "offline"
4) Go to the virtual and recalculate index

Result:
2016-01-27 20:09:56,491 [http-nio-8081-exec-44] [INFO ] (o.a.u.r.s.a.b.t.a.RecalculateIndexService:28) - Recalculating index for repository npm-virtual scheduled to run
2016-01-27 20:10:51,930 [http-nio-8081-exec-52] [INFO ] (o.a.a.n.r.m.NpmPackageMetadataMerger:143) - Fetching external dependencies for 'directory-colorfy' from 'npm-remote'

Should not attempt to retrieve metadata from a remote that is offline.



 Comments   
Comment by Shay Bagants [ 14/Jun/16 ]

The Fetching external dependencies for 'mypackage' from 'npm-remote' logger is misleading as it is printed every time that Artifactory found an external dependency even if it fetches the external dependency from the cache and not from an actual remote server.
Artifactory does respect the repository offline mode flag, and in case that the relevant repository is configured as 'offline', Artifactory will serve the external dependency from the cache only (if exist).

Having said that, since the previous logger is quite confusing, we have removed it. Instead, we have added a new debug logger that indicates if an external reference was found in the package.json that the client tries to resolve through a virtual repository (this was the original goal). The new logger looks like this:

2016-06-14 14:06:52,736 [http-nio-8081-exec-3] [DEBUG] (o.a.a.n.r.m.NpmPackageMetadataMerger:140) - External dependencies references found for package: 'mypackage@2.0.0'

As well, an indication to know if Artifactory actually goes out to fetch an external dependency is similar log to below:

2016-06-14 14:06:55,284 [http-nio-8081-exec-3] [INFO] (o.a.r.HttpRepo:407) - npmjs downloading https://jfrog.com/some/path/to/artifact 14.00 KB 
Generated at Sun Aug 25 01:12:05 UTC 2019 using JIRA 7.6.3#76005-sha1:8a4e38d34af948780dbf52044e7aafb13a7cae58.