AWS Lambda Node.js Full-ICU

女生的网名这么多〃 提交于 2019-12-05 21:16:33

You should set the NODE_ICU_DATA environment variable so that it points to a directory where the correct ICU .dat file can be found.

If you install the full-icu package using the node version that matches the one used by your lambdas, you should automatically get the correct .dat file. E.g. when using the runtime nodejs10.x:

npx -p node@10.x npm i full-icu

This installs node_modules/full-icu/, and you should see the file icudt62l.dat in that directory. The exact name of the file depends on the version of node you're using.

If you're deploying the whole node_modules directory as part of your lambda, NODE_ICU_DATA=node_modules/full-icu/ (equivalent to NODE_ICU_DATA=/var/task/node_modules/full-icu) should work. Otherwise, you can deploy just the .dat file as part of your lambda and point NODE_ICU_DATA at the directory where you deployed the file.

If you're still getting an error and you're sure that NODE_ICU_DATA is correct, make sure that the .dat file version is correct.

As pointed in the node.js docs, you can also use an environment variable, such as NODE_ICU_DATA=/some/directory.

You can easily setup environment variables in your lambda instance settings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!