diff --git a/client/internal/engine.go b/client/internal/engine.go index 21c6a4fe8..c33442b8d 100644 --- a/client/internal/engine.go +++ b/client/internal/engine.go @@ -1488,12 +1488,17 @@ func (e *Engine) handleBundle(params *mgmProto.BundleParameters) (*mgmProto.JobR log.Infof("using MDM debug bundle upload URL override instead of the management-supplied value") uploadURL = override } + uploadURL = debug.ResolveUploadURL(uploadURL, e.DebugUploadURL()) + + // Validated after resolution, so the destination this deployment published + // meets the same rule as one named in the job. Management validates it at + // write time, but a peer can be talking to an older or mismatched server, + // and a bad value should surface here rather than as a transport error + // halfway through the upload. if err := validateBundleUploadURL(uploadURL); err != nil { return nil, err } - uploadURL = debug.ResolveUploadURL(uploadURL, e.DebugUploadURL()) - bundleDeps := debug.GeneratorDependencies{ InternalConfig: e.config.ProfileConfig, StatusRecorder: e.statusRecorder,