-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing from aws-chromelambda to @sparticuz/chromium #492
Merged
oblador
merged 11 commits into
oblador:master
from
thiagodmont:change-from-aws-chrome-lambda-to-sparticuz-chromium
Jan 25, 2024
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ad0af26
change the lib from chrome-aws-lambda to @sparticuz/chromium
thiagodmont 4eec92e
update example dependency
thiagodmont 89a3f3c
create a setup to run the lambda locally
thiagodmont 0ffb5c9
update the docs
thiagodmont 0051638
yarn.lock
thiagodmont da2869d
add the docker lambda prepared on github action
thiagodmont 4b35295
empty line in the end
thiagodmont d126c55
change the command to pretest
thiagodmont 1245ead
updating the chrome-laucher version
thiagodmont c8fb182
add the workspace and using nohoist for the example
thiagodmont 7c11454
verbose log for chrome-laucher when debug is enabled and fix timeout …
thiagodmont File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM amazon/aws-lambda-nodejs:18 | ||
|
||
ENV DEBUG=* | ||
|
||
ADD fixtures ${LAMBDA_TASK_ROOT}/fixtures | ||
|
||
COPY package.json ${LAMBDA_TASK_ROOT} | ||
|
||
COPY node_modules ${LAMBDA_TASK_ROOT}/node_modules | ||
|
||
COPY index.js ${LAMBDA_TASK_ROOT} | ||
|
||
CMD ["index.handler"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### Running the lambda locally | ||
This is to simulate and run the lambda locally for development and test pourpose. | ||
|
||
### Commands | ||
```sh | ||
yarn build | ||
``` | ||
|
||
This command will build the docker image with the lambda. | ||
|
||
```sh | ||
yarn start | ||
``` | ||
|
||
This command will start the docker. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
CONTAINER_ID=$(docker ps -a | grep "example-renderer-aws-lambda" | awk '{print $1}') | ||
|
||
if [ ! -z "$CONTAINER_ID" ]; | ||
then | ||
echo "Stopping and removing container..." | ||
docker stop $CONTAINER_ID 2>&1 | ||
docker rm $CONTAINER_ID 2>&1 | ||
fi | ||
|
||
IMAGE_NAME=$(docker images | grep "example-renderer-aws-lambda" | awk '{print $1}') | ||
|
||
if [ ! -z "$IMAGE_NAME" ]; | ||
then | ||
echo "Removing image..." | ||
docker rmi $IMAGE_NAME 2>&1 | ||
fi | ||
|
||
rm -rf node_modules | ||
|
||
yarn | ||
|
||
cp -R ../../fixtures fixtures | ||
|
||
docker build . -t example-renderer-aws-lambda:latest | ||
|
||
rm -rf fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const { createChromeAWSLambdaRenderer } = require('@loki/renderer-aws-lambda'); | ||
|
||
module.exports = { | ||
handler: createChromeAWSLambdaRenderer(), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@loki/example-running-renderer-aws-lambda", | ||
"version": "0.33.1", | ||
"private": true, | ||
"scripts": { | ||
"build": "sh build.sh", | ||
"start": "docker run -d -p 8080:8080 -t example-renderer-aws-lambda:latest" | ||
}, | ||
"dependencies": { | ||
"@loki/renderer-aws-lambda": "file:../../packages/renderer-aws-lambda", | ||
"@sparticuz/chromium": "118.0.0" | ||
}, | ||
"resolutions": { | ||
"@loki/target-chrome-app": "file:../../packages/target-chrome-app", | ||
"@loki/target-chrome-core": "file:../../packages/target-chrome-core", | ||
"@loki/browser": "file:../../packages/browser", | ||
"@loki/core": "file:../../packages/core", | ||
"@loki/integration-core": "file:../../packages/integration-core" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this, add this project to the workspace by adding it to
workspaces.packages
in the rootpackage.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this way to be able to iterate during the development and have the dependencies updated inside node_modules when I installed them. If I use the version when I install this it will fetch from the npm and not from the code I changed.
Is there another way to achieve this?
I added in the other comment why I didn't use the workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an option for yarn workspaces called
nohoist
which I think should solve this problem: https://classic.yarnpkg.com/blog/2018/02/15/nohoist/There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I did the change using
workspace
andnohoist
.