Consume .txt files in an express app deployed as a Netlify Serverless Function

huangapple go评论61阅读模式
英文:

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/

huangapple
  • 本文由 发表于 2023年3月21日 00:42:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75793027.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定