The bootstrap file must use Unix (Uniplexed Information and Computing Service) format, which means line endings must be LF (\n). Windows uses CRLF (\r\n) line endings by default, which the Linux execution environment of Function Compute cannot parse, causing the function to fail at startup.
Convert the bootstrap file to Unix format
Use one of the following methods on Windows:
| Method | Steps |
|---|---|
| WSL (Windows Subsystem for Linux) | Edit and save the file directly in WSL. Files saved in WSL use LF by default. |
| Git Bash | Open the file in Git Bash and run sed -i 's/\r//' bootstrap. |
| VS Code | Open the file, click CRLF in the bottom-right status bar, select LF, then save. |
| Notepad++ | Go to Edit > EOL Conversion > Unix (LF), then save. |
Verify the line ending format
After conversion, run the following command in WSL or Git Bash to confirm the file uses LF:
file bootstrapThe output should include ASCII text without with CRLF line terminators. If CRLF is still present, repeat the conversion.
If the bootstrap file uses Windows line endings (CRLF), Function Compute returns an error when invoking the function. Convert the file to Unix format before deploying.该文章对您有帮助吗?