title: Cannot reach Amplify CLI-generated Express GET handler ("Error: Network Error")
body: <h3>Setup and Backend info</h3>
  <p>So I've created this Amplify REST API with a route called <code>/device</code>. I generated the API with the <code>CRUD function for DynamoDB (Integration with API Gateway)</code> option. The Lambda's Express code that it generates seems to follow this gist template quite precisely: <a href="https://gist.github.com/dabit3/4544dd262f871866a2ba78bbf5d43f50" rel="nofollow noreferrer">https://gist.github.com/dabit3/4544dd262f871866a2ba78bbf5d43f50</a>. Now here's my issue: the PUT call works just fine, but the <code>GET</code> call I cannot get to work for the life of me.</p>
  <p>On the front end, I get this error when making a PUT call: <code>[Error: Network Error]</code>. And the request doesn't seem to be reaching my backend at all because no logs are coming up in Cloudwatch.</p>
  <p>Here's me initializing the REST API with the Amplify CLI. Note that I selected <code>CRUD function for DynamoDB (Integration with API Gateway)</code></p>
  <pre><code>➜  Yummy-app-backend git:(main) ✗ amplify add api
  ? Select from one of the below mentioned services: REST
  ✔ Would you like to add a new path to an existing REST API: (y/N) · no
  ✔ Provide a friendly name for your resource to be used as a label for this category in the project: · YummyAppBackendAPILocation
  ✔ Provide a path (e.g., /book/{isbn}): · /device
  ✔ Choose a Lambda source · Create a new Lambda function
  ? Provide an AWS Lambda function name: YummyAppBackendFunctionDevice
  ? Choose the runtime that you want to use: NodeJS
  ? Choose the function template that you want to use: CRUD function for DynamoDB (Integration with API Gateway)
  </code></pre>
  <p>My generated GET handler in my backend code comes with this weird setup:</p>
  <pre><code>app.get(path + &quot;/object&quot; + hashKeyPath + sortKeyPath, function (req, res) { /* ...*/ }
  </code></pre>
  <p>... which of course makes sense (if you look at the gist, you'll understand what the <code>hashKeyPath</code> and <code>sortKeyPath</code> are), however even when I try to call this oddly constructed path, I get the same error (<code>[Error: Network Error]</code>).</p>
  <p>Here are my partition/primary key and sort keys: <code>id</code> and <code>createdOn</code></p>
  <p>I have tried calling:</p>
  <pre><code>/device/object/[id]/[createdOn]
  /device/object/[id]
  /device/[id]
  </code></pre>
  <p>And just for good measure:</p>
  <pre><code>/device/object/:[id]/:[createdOn]
  /device/object/:[id]
  /device/:[id]
  </code></pre>
  <p>Anyhow, I'll post my PUT and GET function calls below.</p>
  <h3>Front-end client code</h3>
  <p>Here's my PUT function (works)</p>
  <pre><code>export async function updateDevice(deviceId, deviceName, trackerName, userId) {
      try {
          const response = await API.put(LOCATION_API_NAME, &quot;/device&quot;, {
              body: {
                  id: deviceId,
                  deviceName: deviceName,
                  trackerName: trackerName,
                  userId: userId,
                  createdOn: new Date().getTime(),
                  updatedOn: new Date().getTime(),
              },
              // headers: {}, // OPTIONAL
          });
          return response;
      } catch (error) {
          console.error(
              &quot;Simplified error during updateDevice: &quot;,
              error,
              JSON.stringify(error)
              // {
              //     message: error.response.data.message,
              //     status: error.response.status,
              // }
          );
      }
  }
  </code></pre>
  <p>and here's (a variation) of my GET function (does not work)</p>
  <pre><code>export async function getDevice(deviceId) {
      try {
          const response = await API.get(
              LOCATION_API_NAME,
              &quot;/device/object/&quot; + deviceId + &quot;/&quot; + 1645002153100,
              {
                  body: {
                      id: deviceId,
                  },
                  headers: { &quot;Content-Type&quot;: &quot;application/json&quot; }, // OPTIONAL
              }
          );
          return response;
      } catch (error) {
          console.error(
              &quot;Simplified error during getDevice: &quot;,
              error,
              JSON.stringify(error)
              // {
              //     message: error.response.data.message,
              //     status: error.response.status,
              // }
          );
      }
  }
  </code></pre>
  <p>Can someone please help me identify why it isn't reaching the server?</p>
  <h3>What I have checked</h3>
  <p>There is <a href="https://www.freecodecamp.org/news/going-serverless-with-react-and-aws-amplify-part-2-creating-and-using-serverless-services-d401ba346eeb/" rel="nofollow noreferrer">1 tutorial</a> on this, and when I followed it, it didn't work.</p>