New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not clone to scratch dir for typescript lamdas #376
Conversation
@jacobduba I understand this may not be ideal but currently all the builders are setup to copy to a scratch directory and this is by design. I know we talked about changing this for ESBuild but believe we decided against it to keep the builders the same and try to find a different way to allow this behavior. @mildaniel Is that the correct understanding? |
@jfuss I understand that the solution is not ideal. When I first started digging into the issue was hoping an Esbuild flag would do the trick. No such thing (that I could find) exists. |
I chatted with @mildaniel yesterday about this. We have plans for adding opt in behavior for allowing a build not to copy into scratch for multiple runtimes. We cannot accept this PR, as this will break container builds. As of now, if a build works locally it should also work in the container. Not copying would allow builds to access other parts of project. While this is probably for the best locally, if you (or someone else) has a dependency that needs to be build in a container, you can become stuck due to how we end up mounting what to build in the container. Which is not ideally and could break customers. Going to close this PR, as we are not accepting these changes to the ESbuilder builder and instead the team will be looking to add an opt in behavior in the future (not timelines as of now to share). |
@jfuss @mildaniel We are also experiencing the same issue of being unable to set debug breakpoints in TypeScript code because of this issue. If you're not accepting this PR, do you have any suggestions of a workaround? Without being able to set debug breakpoints in VSCode for TypeScript I don't think we can choose SAM for our upcoming project and will probably have to look at the Serverless Framework instead. Cc @jacobduba |
@chris-fryer ESBuild is still in Beta, so we are still trying to figure out the best ways forward. Due to how everything works today ( The team is discussing how we should handle this though and would note this is not isolated to ESBuild. Which is why we are leaning towards the solution that covers the wider use-case instead of just ESBuild. I know that is not ideal from your direct use-case but we feel is the better thing to do here. |
Hi all, In Thundra, we are also suffering from the same problem. Currently only workaround I see is that manually editing source map file to point to the workspace path ( Is there any other workaround and/or how we can automate this manual editing as part of |
We are not able to get breakpoints working even with the previous workarounds suggested here. Editing the source map file that is created during the build under This is with VS Code and SAM CLI, version 1.67.0. I'm not sure if the workarounds suggested are out of date with this latest version but any guidance is appreciated. |
@jfuss almost two years later typescript debugging is still not working. If this was not the solution, what happened to finding an alternative? |
Source maps are broken with Typescript Lamdas, causing line by line debugging to fail. My team spent a couple days completely stuck thinking we misconfigured something until we discovered it was a problem with the tool.
Since code gets copied to a "scratch dir" in /tmp esbuild points the sourcemap to the tmp directory.
The line-by-line debugger gets confused and skips through any breakpoints that were set.
PR does not clone the code into a scratch directory, compiles using the source directory into the build directory. I spent a lot of time looking for a flag inside esbuild that could point the sources content to another folder, but nothing existed.
Now, line-by-line debugging works.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.