Skip to content

Instantly share code, notes, and snippets.

@mranawake
Last active July 3, 2019 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mranawake/add1879ea076d19bc3d123c376a7ef15 to your computer and use it in GitHub Desktop.
Save mranawake/add1879ea076d19bc3d123c376a7ef15 to your computer and use it in GitHub Desktop.
If you are using AWS Lambda Layers and using WebStorm as the IDE, probably your Layer's aren't being evaluated by the IDE due to incorrect paths. See below for a hack solution.
// Let's assume the "util.js" layer file is saved here: /lib/helpers/nodejs/util.js
// You will refer to the layer like below (according to AWS docs).
const Util = require('/opt/nodejs/src/util');
// Above will work, however WebStorm will give you annoying the "unresolved" warning
// and will not show the code completion. As a solution, create a symlink in your project
// to simulate the layer mount path. See below:
// ln -s lib/helpers opt
// MAJOR DOWNSIDE: This will only work for a single layer.
// If you have a solution for multiple layers (hack solution like above or a proper IDE level),
// please comment below.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment