Error commenting stages: Error: Comment for stack foobar is too long, please report this as a bug
#32 is fixed and works great, however we are still getting the following error for one of the stacks. Reporting this for completeness. FWIW I think we are getting this because the diff (incorrectly, but probably a configuration issue on my end) believes this is a new stack and so it just lists all changes which is very long.
Further ideas for fixing:
- truncate if needed
- maybe there's a way to give github extra long strings, just not as a comment?
- The IAM change list is very long. It's obviously useful though.
Run corymhall/cdk-diff-action@e154417b2bd6f6c53234d7432043044d965e69d5
Error commenting stages: Error: Comment for stack foobar is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new
Error: Comment for stack foobar is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new
at StageProcessor.commentStacks (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:94:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at StageProcessor.commentStages (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:[12](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:13)5:1)
at run (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/action.js:61:1)
Error performing diff: Error: Comment for stack foobar is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new
at StageProcessor.commentStacks (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:94:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at StageProcessor.commentStages (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:125:1)
at run (/home/runner/work/_actions/corymhall/cdk-diff-action/e[15](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:16)44[17](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:18)b2bd6f6c53234d743[20](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:21)43044d965e69d5/lib/action.js:61:1)
FWIW I think we are getting this because the diff (incorrectly, but probably a configuration issue on my end) believes this is a new stack
I have seen this issue before, but I don't remember exactly what the issue was. I think it was something to do with the credentials not being configured correctly (i've created a new issue #35). It might be:
- The github action role is not allowed to assume the cdk lookup role in the stack account
- The stack doesn't have a lookup role (maybe an old bootstrap version) so it just uses the github action role
For the actual issue of a single stack diff being too big, I'm not sure how to handle that. Maybe we can gradually remove parts of the diff starting with the security changes?
I'd have suggested adding it as an attachment, but seems like there is no API for that 😞
Gradually removing content seems like the best idea. Let's make sure to put a big fat warning in though.
@corymhall This current problem makes destructive changes in rather large stacks untraceable. Given that destructive changes is the main feature we are interested in, and it doesn't take up much space in the comment compared to a summary of stack changes, why not make the “Summary of stack changes” feature optional so that it can be disabled and free up a lot of space in the comment for the really important information? What do you think?
https://github.com/corymhall/cdk-diff-action/blob/c377c652c12d042445fa065a4ac2cdb2c9e18ee9/src/stage-processor.ts#L204-L212
That's actually a good idea. We can fallback to just commenting the destructive changes if the comment is too long 👍🏻
I just merged a fix in to the v2-beta branch which should help this. We should not be able to handle much bigger stack comments. I'm still working on a permanent fix.
This should be mostly fixed in v2. I'm going to close this, but if anyone still sees this issue please let me know.