<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vijay Vepakomma on Medium]]></title>
        <description><![CDATA[Stories by Vijay Vepakomma on Medium]]></description>
        <link>https://medium.com/@vijayvepakomma?source=rss-d0b388b64b58------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0ZcXMR16tzBhWgnm.</url>
            <title>Stories by Vijay Vepakomma on Medium</title>
            <link>https://medium.com/@vijayvepakomma?source=rss-d0b388b64b58------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 07:49:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vijayvepakomma/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Debugging Cloud Firestore Rules]]></title>
            <link>https://medium.com/@vijayvepakomma/debugging-cloud-firestore-rules-bfd3068fda?source=rss-d0b388b64b58------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfd3068fda</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[webstorm]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[firestore]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Vijay Vepakomma]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 01:47:54 GMT</pubDate>
            <atom:updated>2020-03-06T01:47:54.629Z</atom:updated>
            <content:encoded><![CDATA[<p>I wanted to integrate my product with Google Cloud Firestore backend without hosting a separate REST API. I found that it supports defining <a href="https://cloud.google.com/firestore/docs/solutions/role-based-acces"><strong>rules</strong></a> for the database that allow us to limit access to the documents based on user authentication and roles defined in the data.</p><p>During the deployment of the rules, I found this link that allows us to <a href="https://github.com/firebase/quickstart-nodejs/tree/master/firestore-emulator/typescript-quickstart"><strong>test</strong></a> the rules in unit tests in TypeScript NodeJS. (I wish it had a java option, but currently (March 2020) it does not).</p><p>I wanted to debug the tests in WebStorm or Visual Studio Code. I looked at the guides for Visual Studio Code and found some links but none of them worked. I was able to get it working on WebStorm using the steps I figured out below.</p><ol><li>Make sure you have the installed the <a href="https://firebase.google.com/docs/cli#install-cli-mac-linux"><strong>firebase-cli</strong></a>.</li><li>Clone the <a href="https://github.com/firebase/quickstart-nodejs/tree/master/firestore-emulator/typescript-quickstart"><strong>repo</strong></a> for testing rules</li><li>Make sure you run npm install</li><li>In package.json under the scripts section, add below line test-emulator</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b997051f9ad5f6f909c86754fc117587/href">https://medium.com/media/b997051f9ad5f6f909c86754fc117587/href</a></iframe><p>4. Open the project in WebStorm</p><p>5. Click on Edit Configurations near the Run button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*FqSiLMY2_DaR9zIbJwGfng.png" /></figure><p>6. Add the TestEmulator configuration as a new npm config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ti1AIj_SHc-x0Npro0cwQQ.png" /></figure><p>a. Enter test-emulator in the Scripts box. This will execute the test-emulator script that we defined in package.json</p><p>7. Add the Attach configuration as an Attach to Node.js/Chrome configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*64lzrKAsMsMQLRoCi4Fedw.png" /></figure><p>a. Make sure port is 9229 . Adjust this port based on the output you notice below.</p><p>b. Choose Chrome or Node.js &gt; 6.3 started with --inspect</p><p>c. NOTE: I am using a 2017 version of WebStorm. The options might differ in the latest version.</p><p>8. Start the TestEmulator configuration as a Run It will start and wait for debugger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yFKdHaq8kZAP2cos16pKHQ.png" /></figure><p>Note the port that the debugger started. If it is different than 9229, update the Attach configuration above.</p><p>9. Add a breakpoint on one of the tests</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ll8RIddtWI-l6ysllFaVDg.png" /></figure><p>10. Start the Attach configuration with the Debug button.</p><p>a. It starts waiting at the first line</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pCTGw9d5qGz3M3ZB25R2w.png" /></figure><p>b. Hit the continue button, it will hit the breakpoints on the test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muKU1dNbmRBRlsF6rdltCw.png" /></figure><p>One caveat, since majority of the code is asynchronous, it is hard to evaluate fields. But at least we are able to look at certain steps.</p><p>I will update with VSCode steps later.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfd3068fda" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>