英文:
Consume .txt files in an express app deployed as a Netlify Serverless Function
问题
I'm trying to deploy an express app to production using netlify lambda. I keep getting this error in the deployment Error: Can't resolve './files/auth0_ss_token_filename.txt'
Is there a plugin for this or what a good workaround. Thanks
我正在尝试将Express应用部署到Netlify Lambda上的生产环境。在部署过程中,我一直遇到这个错误:Error: 无法解析 './files/auth0_ss_token_filename.txt'
。是否有适用于此的插件或者有什么好的解决方法。谢谢
I have tried using a plugin @netlify/plugin-functions-core
but no luck
我尝试使用了插件@netlify/plugin-functions-core
,但没有成功。
英文:
I'm trying to deploy an express app to production using netlify lambda. I keep getting this error in the deployment Error: Can't resolve './files/auth0_ss_token_filename.txt'
Is there a plugin for this or what a good workaround. Thanks
I have tried using a plugin @netlify/plugin-functions-core
but no luck
答案1
得分: 1
下面是要添加到您的 netlify.toml
文件中的部分:
[functions]
included_files = ["相对于项目根目录的文件路径"]
实际答案:
不需要使用任何变通方法。Netlify提供了内置功能来处理这个问题,您可以在这里了解更多信息:https://www.netlify.com/blog/2021/08/12/how-to-include-files-in-netlify-serverless-functions/
英文:
Tl;DR, you need to add the following to your netlify.toml
:
[functions]
included_files = ["path-to-file-relative-to-project-root"]
Actual answer:
There's no workaround needed. Netlify provides a built-in feature to handle this, you can read about it here: https://www.netlify.com/blog/2021/08/12/how-to-include-files-in-netlify-serverless-functions/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论