aws-amplify / aws-amplify/amplify-cli

Function amplify.state files should be displayed in IDE

Open
#13,761 1 comment 0 reactions 0 assignees View on GitHub
feature-request functions
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

18

### Amplify CLI Version

12.11.2

### What operating system are you using?

MacOS Sonoma

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made.

### Describe the bug

The amplify.state file contains a configurable option for custom lambda "build" commands.

I have a setup in an npm monorepo where:
- My functions are monorepo "packages"
- I have other shared "packages" that are dependencies of the functions (e.g. a database utility used by some functions)
- I need to make sure that when I install these packages during amplify build, they're embedded in node_modules as is and not installed as symlinks.

To make the final step work, I have a custom "build" command in my `amplify.state` file. With the build command `npm install --workspaces=false --install-links --no-bin-links --production` I ensure that my database utils monorepo package is copied to the node_modules folder in my lambdas when I run `amplify deploy`.

### Expected behavior

Because I needed to customise the lambda `build` command, I needed to get into the `amplify.state` file. I think this file shouldn't be hidden in the IDE anymore to ensure users can easily access it (as it stands, I'm removing it from being hidden in my IDE settings `.vscode/settings.json`).

Users should probably be able to customise this command when running `function update`.

The customised command could be stored in backend-config.json too, and updated in the `amplify.state` when building for deployment.

### Reproduction steps

- Amplify init a project
- select vscode as IDE
- check `.vscode/settings.json` to see the config of the file being hidden: `"amplify/**/amplify.state": true,`

### Project Identifier

9f0ac5b025abe4eeaef38d0a8f34c06f

### Log output

```
# Put your logs below this line

```

### Additional information

(Aside; I also have a problem where amplify can't detect changes in a symlinked hoisted dependency of my functions when I run `amplify deploy`, so I have a custom pre-deploy command where I write a checksum to a file in each of the functions that depend on these monorepo packages. This checksum is generated by hashing the files tracked in git of the symlinked dependency)

### Before submitting, please confirm:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `amplify init` with VS Code selected and inspect the generated `.vscode/settings.json`, especially the `amplify/**/amplify.state` entry. Trace where this IDE configuration is created, then clarify whether done means removing that hidden-file setting or also supporting a configurable Lambda build command through `function update`.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
cli, developer-experience
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.