aws / aws/amazon-sagemaker-feedback
CORS Error in sagemaker studio when using metrics
- Dominant language
- No language data
- Stars
- 10
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### Product Version
- [ ] Amazon SageMaker Studio Classic
- [X] Amazon SageMaker Studio
- [ ] Issue is not related to SageMaker Studio
### Issue Description
I have a pipeline that has an evaluation step that produces a json file containing metrics (based on example notebooks)
i.e.
```
model_metrics = ModelMetrics(
model_statistics=MetricsSource(
s3_uri=Join(
on="/",
values=[
evaluation_step.properties.ProcessingOutputConfig.Outputs["evaluation"].S3Output.S3Uri,
"evaluation.json",
],
),
content_type="application/json",
)
)
register_args = model.register(
content_types=["application/json"],
response_types=["application/json"],
transform_instances=["ml.g4dn.xlarge"], # g5's not available for batch transform?
inference_instances=["ml.g4dn.xlarge", "ml.g5.xlarge"],
model_package_group_name=model_package_group_name,
approval_status="PendingManualApproval",
model_metrics=model_metrics,
)
register_model_step = ModelStep(name="RegisterModel", step_args=register_args)
```
When I navigate to the deployed model, where I expect to see metrics I get a spinner then

StackOverflow user [@marc-karp](https://stackoverflow.com/users/9796588/marc-karp) suggested I use the browser dev tools and this shows a ton of CORS errors to the evaluation.json uri i.e.
```
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sagemaker-ap-southeast-2-XXX.s3.ap-southeast-2.amazonaws.com/XXX/wk51yik66u6b/Evaluate/output/evaluation/evaluation.json?response-cache-control=No-cache&x-id=GetObject. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 403.
```
### Expected Behavior
Display metrics saved in my s3 bucket
### Observed Behavior
Get CORS error
### Product Category
Models
### Feedback Category
User Interface
### Other Details
_No response_
Contributor guide
Research direction
Start by reproducing the deployed-model metrics view in Amazon SageMaker Studio and inspect browser developer tools for the reported 403/CORS request to evaluation.json. Confirm that the evaluation.json object exists in the S3 output and determine whether the metrics view loads without the CORS error; the payload identifies no repository files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, machine-learning
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100