Error: listen EPERM: operation not permitted when starting a Websocket or HTTP Server

Hello,

I tried to implement a interface connected to a provider, to create Datalayer Nodes via this interface. Just to give you an example:
I want to send a request to my application, that I need a Datalayer Node named XY with the datatype for example Int32. My app receives the request and creates the specified node for me.

First I tried to implement an HTTP Server to provide a REST interface. After this did not work I tried it with an unix socket, like in the python webserver sample.

In both cases I got the error:
Error: listen EPERM: operation not permitted /var/snap/my-provider/x1/transfer.sok (or in case of HTTP Server instead of the path I got the error with the port I tried to open)

The thing I am confused about is, that the sample projects do work and also work if I modify them, just without the interface.

I am happy about feedback, even though this could be a silly question.

Best regards
Benjamin S.

Best reply by nickH

Hi Benjamin, 

Please keep in mind that snaps by default run in their sandbox. Interfaces allow access to a resource outside of a snap’s confinement. 

You have to configure these interfaces for your application in your snapcraft.yaml. Here you can see a list of interfaces to connect to. You could also look at the snapcraft.yaml (folder: /snap) of the python webserver example and check which interfaces are used here. 

Best regards, 

Nick 

View original
1 reply