Open suzettewilliams opened 1 year ago
The previous deploy script copies over submodules into a new dir named package. It seems possible that your submodules weren't pulled in locally before deploying! Try running git submodule update --init --recursive
before running locally and deploying.
See line 18 which copies the modules dir (containing multiple git submodules): https://github.com/zotero/translation-server/blob/e0e31ecf82114f5af8a72550b81e012ebd94b457/lambda_deploy#L16-L20
Thank you SevanBadal. I will follow your directions and I will let you know the outcome
The modules were copied and the problem still persists. My lambda deploy file is shown below:
#!/bin/bash -e
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z $1 ]; then
echo "Usage: $0 config.env" >&2
exit 1
fi
set -a
. "$dir/$1"
set +a
rm -rf package
mkdir package
# Skip files that aren't required i.e. ".git"
cp -r config package/
cp -r modules package/
cp -r node_modules package/
cp -r src package/
# Remove broken symlinks because "sam package" complains
find -L package/ -maxdepth 10 -type l -delete
j2 "$dir/lambda_template.yaml.j2" > "$dir/package/template.yaml"
sam package --template-file "$dir/package/template.yaml" --s3-bucket $deployment_bucket_name --output-template-file "$dir/package/package.yaml"
aws cloudformation deploy --template-file "$dir/package/package.yaml" --stack-name $stack_name --capabilities CAPABILITY_IAM
Can you please paste the result of ls modules/translate
here? We want to confirm that the translate directory is not empty.
swilliams@LAPTOP-I0QMUR48:~/translation-lambda/translation-server$ ls modules/translate
src
swilliams@LAPTOP-I0QMUR48:~/translation-lambda/translation-server$ ls src
args.js formats.js proxy.js textSearch.js webEndpoint.js
cors.js http.js searchEndpoint.js translation webSession.js
debug.js importEndpoint.js server.js translators.js zotero.js
exportEndpoint.js lambda.js testEndpoint.js utilities.js
I'm not seeing promise.js in the contents of your modules/translate/src
directory! This could be related to the error message you reported above which is complaining about not finding a module /var/task/modules/translate/src/promise
:
I deployed the zotero translation-server on AWS lambda using your previously deleted lambda_deploy script. Every time I make a request via the API Gateway url the translation-server fails with a "Missing authentication token" The error logs show:
Lambda execution failed with status 200 due to customer function error: Error: Cannot find module '/var/task/modules/translate/src/promise' Method completed with status: 502
Thanks, yes, the promise js file is missing. I will add, and let you know the outcome.
I am tryng to redeploy, by using the updated repository. but I am stuck at./lambda_deploy: line 15: j2: command not found
The jinjacli is installed jinja2 in ./env/lib/python3.8/site-packages (3.1.2)
. Prior to using the updated code, I deployed with the promise module, but the same error occurred, because the function was looking in /var/task/modules/translate/src/promise for the promise module, but the promise.js file was in my home folder/translation-server/modules/translate/src/promise*. I am thinking of creating a symbolic link. I am unsure if that will work, since I am still stuck at j2 command not found. Any thoughts about the J2 command?
I deployed the zotero translation-server on AWS lambda using your previously deleted lambda_deploy script. Every time I make a request via the API Gateway url the translation-server fails with a "Missing authentication token" The error logs show:
I installed the promise module, but cloudformation doesn't update.
Are there updated instructions or documentation for getting the zotero translation server running on AWS lambda?