appSettings.json file not found on AWS lambda

While you don’t necessarily need to actually have a json config file when using lambdas, we like to have them to add some additional settings more easily than configuring that many env variables, and while releasing a new lambda I found it wasn’t releasing the file alongside the lambda itself when using Amazon’s Sam Client, though I think this can also happen when releasing using the AWS Wizard.

To solve this issue, simply right click on the json file you want to be added to the compiled code and select Properties, then set the “Copy to output directory” property to “Always“.

Alternatively, just add this to the .csproj xml file:


  <ItemGroup>
    <None Update="appsettings.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

Leave a Reply

Close Bitnami banner
Bitnami