Network undefined in docker stack

am using docker stack to deploy some services on a swarm network with two nodes . I created a network which I can see through

docker network ls but when I am trying to use that network in docker stack file I am continuously getting error Network undefined . Am I doing something wrong here? I dont know why docker stack is been unable to pick overlay network

Here is my docker stack file

version: '3.4'
 
services:
    orderer1st:
        image: hyperledger/fabric-orderer:1.2.1
        networks:
            - fabricoverlay
        ports:
              - 7050:7050
 
        environment:
              - ORDERER_GENERAL_LOGLEVEL=info
              - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
              - ORDERER_GENERAL_GENESISMETHOD=file
              - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
              - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
              - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
 
        command: orderer
        volumes:
             - ./channel-configuration/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
             - ./msp:/var/hyperledger/orderer/msp

you still need to define the network in your compose file in order to allow services to use it:

networks:
 fabricoverlay:
   external: true