Hello, I am currently using cesium to build an application. Up until yesterday, I’ve been able to grab my cesium ion resources just fine with the below code. I’m loading a kml file I have stored there.
const loadKML = async () => {
try {
setIsLoading(true); // Set loading state to true
const ionKmlResource = await IonResource.fromAssetId(2528900, {
accessToken: import.meta.env.VITE_CESIUM_API_KEY,
});
await kmlDataSource.load(ionKmlResource.url);
viewer.dataSources.add(kmlDataSource);
const newEntityIds: string[] = [];
const entities = kmlDataSource.entities.values;
entities.forEach((entity) => {
const entityId = entity.id;
newEntityIds.push(entityId);
entityRefs.current[entityId] = entity;
entity.show = airspace3dEnabled;
});
dispatch(updateCurrentAirspaceEntityIds(newEntityIds));
} catch (error) {
console.error('Error loading KML file:', error);
} finally {
setIsLoading(false); // Set loading state to false after loading is complete
}
};
However now whenever the IonResource.fromAssetId() funciton or the kmlDataSource.load(), I’m unsure exactly which function is making the API request, I’m getting this 401 error.
|GET||
| — | — |
|scheme|https|
|host|assets.ion.cesium.com|
|filename|/us-east-1/2528900/doc.kml|
||
|Address|18.64.247.73:443|
Status
401
VersionHTTP/3
Transferred464 B (62 B size)
Referrer Policystrict-origin-when-cross-origin
DNS ResolutionSystem
access-control-allow-origin | * |
alt-svc | h3=“:443”; ma=86400 |
---|---|
content-length | 62 |
content-type | application/json |
date | Sun, 14 Apr 2024 15:34:34 GMT |
server | CloudFront |
via | 1.1 d37a77d65bd24dcdf157828a595ed2fa.cloudfront.net (CloudFront) |
x-amz-cf-id | FDOCfysQYC8ktz7WxAubGZ98T9It97uBn4mfYhhWSW39AbU2_7gfMg== |
---|---|
x-amz-cf-pop | BNA50-P1 |
x-cache | LambdaGeneratedResponse from cloudfront |
Accept | / |
Accept-Encoding | gzip, deflate, br |
---|---|
Accept-Language | en-US,en;q=0.5 |
Connection | keep-alive |
Host | assets.ion.cesium.com |
Origin | http://localhost:5173 |
Referer | http://localhost:5173/ |
Sec-Fetch-Dest | empty |
Sec-Fetch-Mode | cors |
Sec-Fetch-Site | cross-site |
User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0 |
I am using my own API access token, not the default, and it has read permissions and the token allows all url and all assets. Like I said it worked fine up until yesterday.