Hi, I’ve a problem embedding my model using the v3 version of the viewer.
The viewer report “Embedding not allowed for origin http://localhost:63342” even if the domain is whitelisted.
Using the version v2 of the viewer this problem is not present.
Do you have any suggestion?
I checked the list of domains whitelisted for your user and I do not see localhost:63342 (I see localhost with different ports though). Please add exactly the domain with port and let me know if it fixes the issue.
Hi Mathieu,
I don’t know why you haven’t seen localhost in my domains whiteisted but this is what I’ve set in my setting and it works on the version v2 but it doesn’t work on the v3 version.
There is another way to set the domains?
My apologies, I had made a wrong manipulation, the domain is listed correctly. I could embed one of your models locally on this port without issues with viewer 3, could you maybe share the code you are using for embedding so we can investigate the issue?
I’ve just copy-pasted the first step I’ve found on the migration guide.
This is what I’ve got so far:
index.html
<!DOCTYPE html>
<html lang="it">
<head>
<title>ShapeDiver Sandbox</title>
<meta charset="UTF-8" />
</head>
<body>
<div style="width: 100%; height: 100%;">
<canvas id="canvas"></canvas>
</div>
<script src="https://viewer.shapediver.com/v3/2.3.5/bundle.js"></script>
<script type="module" src="src/index.js"></script>
</body>
</html>
index.ts
const SDV = (<any>window).SDV;
(async () => {
// create a viewport
const viewport = await SDV.createViewport({
canvas: document.getElementById("canvas"),
id: "myViewport"
});
// create a session
const session = await SDV.createSession({
ticket: "498016a05183498996efc757969a690c91c2df294c2d157b4cb853277aebfebb7c173d42b666e79f34829192add0e52104080fb079490cf15fd4ecb451a56ec2ea62cdc8986da9cac3ac03213ab00dcfa1faaf7447a72d040ee3af1e7b1ef970bd1d6f68319415dc244f395967f66c44162f09ea3096a949-81c40e79bbf81d05f6f66c24a4a98950",
modelViewUrl: 'eu-central-1',
id: "mySession"
});
})();
and this is the result in the browser:
Are you sure you are spinning your local server on the right port? I see 63343 in your screenshot…
Sorry I’ve changed the configuration of the IDE for another project, I’ve updated the whitelisted domains and the error still occurs.
I’ve also tested the viewer on the staging part of the website. In the same scenario the viewer v2 works but the code I’ve just posted return me this message again.
Could you try to edit a property of the model you are trying to embed (any property, for example its name or a viewer setting), then save it and try again embedding? If that doesn’t work, I would need the url of the model you are trying to embed so that our development team can investigate on their side.
Can I edit the property directly from Shapediver or I have to re-upload the file completely?
I’m asking this because I’ve already made a change from the viewer online and save it.
I’ve also tested the v3 viewer with 3 different grasshopper files we have uploaded on Shapediver but no one works with the v3 viewer.
This is the link of one of our products: ShapeDiver.
I’m available if you need anything else.
The viewer 3 only works with the exact model view url you get from the model view page. You are using a legacy model view url which only works with the viewer 2. Please copy paste the url you get straight from the platform instead:
const SDV = (<any>window).SDV;
(async () => {
// create a viewport
const viewport = await SDV.createViewport({
canvas: document.getElementById("canvas"),
id: "myViewport"
});
// create a session
const session = await SDV.createSession({
ticket: "e1987b8c43bef3200bc47005bc2bbe2f28f22263e0845f42310e67091c6d9b2f9fe3d633971ab95a16bdfec53940b28ba0cefe0a62c49d8de8977e76669668d534d8d2c6f8f7072df2b9c46f649e52135f9f835adb6200792624df97cf749b8a43edbff0ffbf49-2b250981953e59f3b663ff8740537a35",
modelViewUrl: 'https://sdeuc1.eu-central-1.shapediver.com',
id: "mySession"
});
})();
I’ve changed it as you suggested.
Same error, nothing changes.
I’ve also tried change the ticket_id using the backend access but I’ve had no luck.
@Ste_1993 we have checked the precise configuration of your model on our backend system, and it all looks good. The reason for this problem is most probably somehow related to specifics in your application. Please share the complete example, ideally using a link that we can access to reproduce the problem. If you do not want to share the link here in the forum, please send a PM.
Hi Alexander,
I’ve rebuild from scratch the backend of my integration and I’m now it seems able to make the v3 viewer works.
I really don’t know how it was possible. I will spend the afternoon investigate on it.
I will post anything i will find.
Thanks for the support.