dymo-connect-framework
dymo-connect-framework copied to clipboard
CORS issues
If I simply run the JavaScript demos untouched I get CORS errors from Chrome.
- Chrome on Windows Version 93.0.4577.82 .
- DYMO Connect 1.4.2.82
- Latest version of Framework downloaded from GitHub today.
dymo.connect.framework.js:2 Access to XMLHttpRequest at 'https://127.0.0.1:41951/DYMO/DLS/Printing/RenderLabel' from origin 'https://XXXXX.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
how can this be fixed ?
Also experiencing this issue. I assume Dymo Connect Service needs to be updated to return "Access-Control-Allow-Origin: *" in the header on all requests to avoid this issue.
I have called DYMO and emailed this address per the phone support sdkreply
@ newellco.com
Perhaps if we all call and email we might get some attention faster...
I was able to find a workaround for chrome. chrome://flags/ disable > Block insecure private network requests.
Not sure on how safe it is, but it got me up and running. I too have reached out to support with no help.
I was able to find a workaround for chrome. chrome://flags/ disable > Block insecure private network requests.
Not sure on how safe it is, but it got me up and running. I too have reached out to support with no help.
This worked for me. my client was using edge which is based on chrome, i think it might have broken because of this https://developer.chrome.com/blog/private-network-access-update/
Also having this issue. I can get it to work right up until the call to print. Turning off browser security seems like the wrong answer. Is Dymo still supporting this framework or not?
I was able to find a workaround for chrome. chrome://flags/ disable > Block insecure private network requests.
Not sure on how safe it is, but it got me up and running. I too have reached out to support with no help.
I just tried this, and I still get the CORS error when it tries to issue the print.
To be fair, I also had to use combinatronics to even link the js into the project.
IT seems like they are just letting this die, which is sad. Very useful feature.
I've recently been trying to reverse-engineer the dymo-connect-framework.js file to solve a new issue that has come up for me - the getPrinter function has suddenly stopped returning printers even though the GetPrinters Web Service endpoint is returning them (I resorted to building a simple Ajax function to fetch the printer from the endpoint directly instead of using the framework's function). The file is in a real messy state and the code seems severely over-engineered. Without attention from Dymo the only hope is if the community takes over ownership and maintenance.
I know the DYMO team is a bit overloaded at the moment with the launch of the new LabelWriter 5xx series printers. I will raise this with my contacts there and see if we can get an official response/update.
In the meantime, have you tried going back to the older DYMO Label Software v8.7.4? That's what I'm currently running and it looks like the web service is returning the access-control-allow-origin: *
header in the response.
Thank you @dpolivy in case they cant get this fixed, I found this page with some higher ups at Dymo and we can try emailing some bosses to get attention... https://www.elliott.org/company-contacts/newell-brands/
Thank you for your patience.
labelwriter.com will be deprecated sooner or later because it is aged server. And labelwriter.com ran into an issue passed into 127.0.0.1 which blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local.
Javascript SDK works with sample html files with your local framework.js file against your local Web Api without blocking CORS policy with following steps.
We have a shortterm work-around is:
- Download dymo.connect.framework.js file and sample files into client's local folder.
- Put it in the parent folder for the html.
Dymo.connect.framework.js file is: https://github.com/dymosoftware/dymo-connect-framework
Sample files are: https://github.com/dymosoftware/DCD-SDK-Sample/tree/master/JavaScript
Sorry @dymosoftware don't understand. Many of us are printing from a remote server on the web to a local printer. How will this solve the CORS issue of printing from a remote web server https://example.com/dymo.connect.framework.js to DYMO printer on localhost?
I read from @dpolivy that reverting to older version of DYMO connect will work. Where can we find DYMO Label Software v8.7.4 downloads for Mac and Windows?
@ethanpil You can find links to the older versions on the Compatibility Chart page here:
https://www.dymo.com/compatibility-chart.html
Yeah, that answer doesn't work. I'm not writing a web service to run on my computer to talk to the printer on my computer. I need to be able to have our hosted site send labels to the connected printer.
I'm also not able to include the 'labelwriter' source, as it is not https. I had to use a third party site to convert the raw.github file.
Hi, do you have any link with a sample that we may try on our side to test with web service?
DYMO web api accepts all cross origins as default already, and we had to setup new sample website which fixes CORS issue between http://labelwriter.com and https://127.0.0.1:xxxx or https://localhost:xxxx. http://labelwriter.com will be deprecated sooner or later.
The new sample web pages are found "Sample Html Pages" section in Readme file in https://github.com/dymosoftware/DCD-SDK-Sample.
The same sample html pages links are: https://s3.amazonaws.com/download.dymo.com/dymo/Software/JavaScript/CheckEnvironment/CheckEnvironment.html https://s3.amazonaws.com/download.dymo.com/dymo/Software/JavaScript/VisitorManagement/VisitorManagement.html https://s3.amazonaws.com/download.dymo.com/dymo/Software/JavaScript/PreviewAndPrintLabel/PreviewAndPrintLabel.html
Thank you for your patience.
Hey Guys, First off thank you for your response. Moving the script local to the project does work, I also used combinatronics to scrape it from your github. JSDelivr I think does the same thing. That also gets around the https issue but still allows us to grab the framework from you.
ON my issue of the CORS issue when issuing the label.print, that seems to have gone away. My printer stopped being detected, and I had to manually install the driver to a usb port. After that, label.print begain working. The error I was getting back before was rejected due to CORS, but that error might actually have been false?
I'm up and running, so thank you. Not sure if ethanpil is still having the same issue.
@ande2407 my experience is exactly the same, however I have not managed to get the printer to be detected. You wrote "manually install the driver to a usb port" -- what does that mean, could you explain what you did?
@dymosoftware I tried the sample html pages from the AWS links you provided, but they don't even work to detect my printer. At least the demo as I have locally will detect the printer but has the CORS issue.
I'm at a complete loss here, since the suggestions made by @dymosoftware the official developers don't make any sense, and don't address the issues at hand for anyone!
@ande2407 my experience is exactly the same, however I have not managed to get the printer to be detected. You wrote "manually install the driver to a usb port" -- what does that mean, could you explain what you did?
Sure. I'm on Windows 10. When going to 'add printers', the Labelwriter 450 turbo would not show up. I would just click, my printer wasn't detected. Then I would 'add it manually' and select the printer manufacturer and model. I created a usb virtual port for it and let it install the driver.
After that it worked, although only on one port. I assume I might have to create a second virtual port for it for my other USB port, but didn't explore it.
I have the latest Dymo Connect software installed.
@ethanpil I did my testing in firebase. I was able to load the label printer sample to a hosted app there and get it to work. I only had to change the include for the framework. I used combinatronics to create a cdn from the raw.github. After that it worked.
If you think it is helpful for you, I can set that back up and send you the link. I took it down as it was only for testing before moving to my actual project.
Hi, do you have any link with a sample that we may try on our side to test with web service?
I have tried changing the Chrome setting, just to see if it work, it did not. I updated to the latest dymo-connect-framework JavaScript, it did not help.
It's clear to me that @cage85 is correct. The only solution is to release a new verision of Dymo Connect which sends the correct HTTP headers.
Just to be clear, I am using a remote web server with the printer on the local computer.
I am happy to send you a link I do not want to post publicly here.
If it helps, here is a link to the dymo sample running, hosted in firebase. The only thing different is how the framework is included.
https://dymo-original.web.app/
This works printing to my machine with a 450 turbo.
Sorry, none of these solutions work for me. Here's a screenshot from my chrome which clearly indicated the issue is simply the missing headers from 127.0.0.1
which is the DYMO HTTP server...
@ethanpil I think the CORS issue might be a red herring here. The original request is returning a 500 error which might indicate some other issue on the system. It's possible (likely?) there's a bug in the web service where it is not including the CORS header when returning a 500 error. If you look at the prior GetPrinters
or StatusConnected
API calls that succeed, my guess is the CORS header will be there. If you look at the actual response, is there a more detailed error message?
@dpolivy @ethanpil Yes, I have come to the same conclusion. There is some other error happening which is resulting in a 500 before all the headers are sent. Unfortunately there is no detailed error description to be found anywhere including Dymo Connect Web Service logs. I've spent many hours trying different ways of invoking the print command (label.print, printLabel etc.) and other things but have come up empty. Next I'm going to test different label templates to see if that's the issue.
After tearing my hair out over this for some time I finally found a solution to my issues. It turns out the label type specified in my label template was not compatible with the language that the DYMO software was installed in. It seems that if DYMO Connect is installed on an English US version of Windows, metric-based label types (e.g. Name badge 54 x 101mm S0722430) will not print. I don't understand why all label types are not supported regardless of OS locale, or why error messages were not printed to DYMO Connect Web Service logs to indicate the issue.
Anyways, as @dpolivy suspected, when trying to print my labels the PrintLabel endpoint would return a 500 before complete headers were returned, which is why the "Access-Control-Allow-Origin: *" was missing. I changed my Windows display language to a metric-based one, reinstalled DYMO Connect, and I was back in business.
@ethanpil I'm not sure if this is your issue as well, but to confirm, open DYMO Connect and check which label types (i.e label sizes) are available, and ensure that the label type used in the sample script is among them. If not, you will get a 500 error.
DYMO web api accepts all cross origins as default already, and we had to setup new sample website which fixes CORS issue between http://labelwriter.com and https://127.0.0.1:xxxx or https://localhost:xxxx. http://labelwriter.com will be deprecated sooner or later.
The new sample web pages are found "Sample Html Pages" section in Readme file in https://github.com/dymosoftware/DCD-SDK-Sample.
The same sample html pages links are: https://s3.amazonaws.com/download.dymo.com/dymo/Software/JavaScript/CheckEnvironment/CheckEnvironment.html https://s3.amazonaws.com/download.dymo.com/dymo/Software/JavaScript/VisitorManagement/VisitorManagement.html https://s3.amazonaws.com/download.dymo.com/dymo/Software/JavaScript/PreviewAndPrintLabel/PreviewAndPrintLabel.html
Thank you for your patience.
Unfortunately I'm still getting the CORS error even on your sample html pages.
@rfdrake27 see above, the CORS issue is probably due to another error occurring before the Dymo Connect Web Service has had a chance to send the correct headers.
Hi, i had exactly the same Issue. WIN10H1 aktuell Dymo .82 Afer Reinstalling the Software it was working on Chrome and Edge