Skip to content
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

Node.js 10.x support #156

Closed
mberneis opened this issue Oct 19, 2019 · 29 comments
Closed

Node.js 10.x support #156

mberneis opened this issue Oct 19, 2019 · 29 comments

Comments

@mberneis
Copy link

Amazon announced that they drop support for Node8 - Switching the Node Version for the Lambda function to 10.x results in a response

{
message: "Internal server error"
}

Amazons Notice:

We are contacting you as we have identified that your AWS Account currently has one or more Lambda functions using Node.js 8.10, which will reach its EOL at the end of 2019.

> What’s happening?

The Node community has decided to end support for Node.js 8.x on December 31, 2019 [1]. From this date forward, Node.js 8.x will stop receiving bug fixes, security updates, and/or performance improvements. To ensure that your new and existing functions run on a supported and secure runtime, language runtimes that have reached their EOL are deprecated in AWS [2].

For Node.js 8.x, there will be 2 stages to the runtime deprecation process:

1. Disable Function Create – Beginning January 6, 2020, customers will no longer be able to create functions using Node.js 8.10

2. Disable Function Update – Beginning February 3, 2020, customers will no longer be able to update functions using Node.js 8.10

After this period, both function creation and updates will be disabled permanently. However, existing Node 8.x functions will still be available to process invocation events.

> What do I need to do?

We encourage you to update all of your Node.js 8.10 functions to the newer available runtime version, Node.js 10.x[3]. You should test your functions for compatibility with the Node.js 10.x language version before applying changes to your production functions.

> What if I have issues/What if I need help?

Please contact us through AWS Support [4] or the AWS Developer Forums [5] should you have any questions or concerns.
@jedsmith13
Copy link

It looks like the CustomResourceFunction is fine but that there is an issue with the image handler function. Looking at the error logs it appears that it is probably that sharp-node needs to be compiled for a specific version of Node.

I am going to need this so I will take a look and see if I can get it working and if I can I will create a PR.

@jedsmith13
Copy link

I created a pull request for this. #157

To make use of it before the changes are applied to the main build you will have to follow the example for a custom deploy in the readme. Of note make sure when you build that you do it with node 10 as the problem with sharp was that it was built for NodeJS 8, I am not entirely sure if minor version differences are an issue.

@dalen
Copy link

dalen commented Oct 22, 2019

I tried compiling it for node10, and it seems to work well then.

@beomseoklee
Copy link
Member

We are trying to update the solution in this year to support Node.js 10.x.

@lmontier
Copy link

Do you have any news ? (because it is almost the end of the year...)

@dscpinheiro
Copy link

Hi @lmontier,

Sorry for the delay in the response.

We are still working on the update, and we’re planning to release it before December 31st.

We’re also going to use node12 (instead of node10), since this version will be supported until April 2022 (https://aws.amazon.com/about-aws/whats-new/2019/11/aws-lambda-supports-node-js-12/).

@martin
Copy link

martin commented Dec 12, 2019

Will the update come before Christmas? Changes at the end of the year are generally a bad idea. It would be good if the solution is ready soon so that we can use it safely and tested.

@dscpinheiro
Copy link

Hi @martin,

Yes, we're planning to release it before Christmas.

@nicosh
Copy link

nicosh commented Dec 16, 2019

@dscpinheiro , any update? christmas is coming up soon

@georgebearden
Copy link
Member

HI All - The latest commit contains the Node updates. Please let us know if you need additional assistance.

@andidev
Copy link

andidev commented Dec 16, 2019

@georgebearden what is the recommended way to upgrade without any downtime?

@dscpinheiro
Copy link

Hi @andidev,

You should be able to update an existing stack with the latest template (https://s3.amazonaws.com/solutions-reference/serverless-image-handler/latest/serverless-image-handler.template). That will require minimum downtime since the lambda function runtime has changed.

@vitalinfo
Copy link

@andidev it depends on what sharpJS features you are using, because 0.23.3 doesn't really compatible with 0.21.3.

@brad13x
Copy link

brad13x commented Dec 16, 2019

@dscpinheiro can you dumb it down a little bit for me. I cant find anything on updating templates for Lambdas on AWS.

@dscpinheiro
Copy link

@brad13x, here's what I meant:

  1. Go to your existing stack and click update:
    update-01

  2. On the Update stack screen, select "Replace current template" and specify the latest template (https://s3.amazonaws.com/solutions-reference/serverless-image-handler/latest/serverless-image-handler.template):
    update-02

@brad13x
Copy link

brad13x commented Dec 17, 2019

@dscpinheiro Thank you so much! This helped a lot. Did not know about this area of the site.

@brad13x
Copy link

brad13x commented Dec 17, 2019

Is anyone else getting this error? 1 validation error detected: Value 'serverlessrepo-image-resizer-serviceImageHandlerFunctionRole-us-west-2' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64 (Service: AmazonIdentityManagement; Status Code: 400; Error Code: ValidationError;

@vitalinfo
Copy link

any advices?
CloudWatch Logs role ARN must be set in account settings to enable logging (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException;

@simonian
Copy link

@brad13x When you launch the CloudFormation stack under the hood it creates IAM::Role with the name of the format {CloudFormationName}ImageHandlerFunctionRole-{CloudFormationRegion}. In your case it is serverlessrepo-image-resizer-serviceImageHandlerFunctionRole-us-west-2.

The problem is that the resulting IAM::Role name should be less than or equal to 64 characters. But in your case, there are 70 characters.

To solve this issue assign the CloudFormation shorter name with no more than 26-30 characters, depending on the region where you deploy the stack.

Unfortunately, you can not update the CloudFormation name, so you have to delete the current stack and create the new one. Here is the field where you have to set the name with the proper length:
qodj2hrkjw

@martin
Copy link

martin commented Dec 17, 2019

I get some errors when i update the Stack with the new template file:

my_stackname, UPDATE_ROLLBACK_IN_PROGRESS: The following resource(s) failed to create: [Logs, ApiLoggingRole]. The following resource(s) failed to update: [ImageHandlerApiDeployment, CustomResourceCopyS3, CustomResourceAnonymousMetric].

and

ImageHandlerApiDeployment, UPDATE_FAILED: CloudWatch Logs role ARN must be set in account settings to enable logging (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 87a64f3-xxxx-xxx-…)

and

Resource creation cancelled for CustomResourceAnonymousMetric, CustomResourceCopyS3, ApiLoggingRole and Logs with status UPDATE_FAILED

In the update view Configure stack options i select nothing for Permissions -> IAM role - optional (like before). And for Advanced options -> Stack policy i have select No stack policy like before.

In the Review view with Change set preview i have 16 changes (4 "new" and 12 "Modify" actions).

Any ideas? @georgebearden, @dscpinheiro

@dscpinheiro
Copy link

Hi @martin,

It looks like it's the same issue as #172.
I'll investigate and reply there.

@dscpinheiro
Copy link

@martin, @andidev

Yesterday I wrongly said that updating was possible, but it turns out that is not the case.

I apologize for the mistake, and I listed some alternatives on #172 (comment), and I'll make sure this information is included on the implementation guide.

Again, sorry for the inconvenience.

@marco910
Copy link

Hi everyone,

Before I've updated the image handler to NodeJS 12.x it was possible to enter a URL like:
https://xxxx.cloudfront.net/fit-in/1500x0/image.jpg
The response was the image with a width of 150px and the height according to the aspect ratio.

Now, after the update, I get the following Error in CloudWatch:
Expected positive integer for height but received 0 of type number
at Object.invalidParameterError (/var/task/node_modules/sharp/lib/is.js:101:10)
at Sharp.resize (/var/task/node_modules/sharp/lib/resize.js:225:18)
at ImageHandler.applyEdits (/var/task/image-handler.js:72:27)
at ImageHandler.process (/var/task/image-handler.js:27:46)
at Runtime.exports.handler (/var/task/index.js:24:53)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Is it still possible to enter only a width and get the image back with the height according to the aspect ratio?

Thanks in advance!

@dscpinheiro
Copy link

Hi @marco910,

We had to update the version of sharp, and I believe the issue you mentioned is the same one as this: #171

Could you try this approach (#171 (comment)) and check if the problem still happens?

@marco910
Copy link

Hi @dscpinheiro,

Yes that's the same issue as in #171 . @mberneis is requesting the image with JSON but in my case the request is with a "normal" URL. How can I make a valid request with a URL?

@dscpinheiro
Copy link

Hi @marco910,

So I just tested and it doesn't look like it's possible to do the request you want via URL on v4.1. Unfortunately, as I mentioned on the other issue, we had to update sharp for compatibility with Amazon Linux 2.

The alternative is to do the request via JSON, and I'll update the documentation to make that clear.

@dalen
Copy link

dalen commented Jan 8, 2020

@dscpinheiro Can't you make the handler convert a 0 passed on the url into a null?

@dscpinheiro
Copy link

@dscpinheiro Can't you make the handler convert a 0 passed on the url into a null?

Yes, that's definitely an option. I'll add this change to our backlog for the next release.

@marco910
Copy link

@dscpinheiro Can't you make the handler convert a 0 passed on the url into a null?

Yes, that's definitely an option. I'll add this change to our backlog for the next release.

Hi, When can we expect the feature back in the image handler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests