RETURN not work on Javascript Driver

This cypher query is working on Neo4j Browser but its not working with javascript driver. It returns 0 record. I need ID of node a.

const result: v1.StatementResult = await session.run(
      'MATCH (f:Firma) WHERE id(f) = $fId MERGE (f)-[y:YASIYOR{tip:$aTip}]->(a:Adres{mahalle: $aMah, cadSok: $aCadSok, numara: $aNo, daire: $aDaire}) RETURN a',
      {
        aCadSok: 'some',
        aDaire: 'dummy',
        aMah: 'variables',
        aNo: 'for',
        aTip: 'testing',
        fId: 1163
      }
    );

You might need to do neo4j.int(1163) for fId.

Thanks for the reply,

I found the problem. When I try to use MATCH and MERGE in the same session.run, that is not works in Javascript Driver but it works on Neo4j's browser. But when i run MATCH and MERGE at different session.run function, that works. I think i need to write a transaction for that situation.