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

Error when deployed from Windows #80

Closed
paulycloud opened this issue Oct 30, 2018 · 19 comments
Closed

Error when deployed from Windows #80

paulycloud opened this issue Oct 30, 2018 · 19 comments

Comments

@paulycloud
Copy link

paulycloud commented Oct 30, 2018

After a successful completion of the entire Laravel set up and receiving my API endpoints when running "vendor/bin/bref deploy", I keep getting the following error when hitting my endpoint:

{
"message": "Internal server error"
}

The best thing i can find in the logs is this:

`Process exited before completing request

`Any ideas to fix this?

@mnapoli
Copy link
Member

mnapoli commented Oct 30, 2018

Hi, you will need to have a look into the logs on cloudwatch (or using vendor/bin/bref logs).

@g87andres
Copy link

I am getting the same error... here are my logs from cloudwatch

2018-11-05T02:23:18.961Z c2533785-e0a1-11e8-a0d3-edabfbcdb17b Error: spawn EACCES
at exports._errnoException (util.js:1018:11)
at ChildProcess.spawn (internal/child_process.js:319:11)
at exports.spawn (child_process.js:378:9)
at exports.handle (/var/task/handler.js:39:18)

@mnapoli
Copy link
Member

mnapoli commented Nov 5, 2018

@g87andres is it with Laravel too? Have you changed serverless.yml or handler.js in any way? What is your Bref version?

Please try removing the .bref directory and try deploying again.

@paulycloud
Copy link
Author

@mnapoli and @g87andres. I have the same cloudwatch error logs as well. After researching online, it has something to do with the read permissions on the zip file generated and upload to S3.

I am using a windows machine. Is there a way to ensure the zip file has the correct read permissions on it?

Some of the suggestions I found were adding the "mode" property to the severless.yml file for this:

mode: 0644 # change mode for all files
 include:
    - handler.js
    - bref.php

@mnapoli
Copy link
Member

mnapoli commented Nov 5, 2018

Oh that's interesting, @g87andres are you on Windows too?

@paulkamau2015 you can edit the serverless.yml file and try that?

@mnapoli mnapoli added bug and removed support labels Nov 5, 2018
@mnapoli mnapoli changed the title "message": "Internal server error" Execution error when the lambda is deployed from Windows Nov 5, 2018
@paulycloud
Copy link
Author

@mnapoli , I did try updating the serverless.yml but it did not work, unfortunately. the same error appears. I also tried to set the permissions to "everyone" on S3 for the zip file but that did not work as well.

@g87andres
Copy link

Yes I am on windows as well. If I deploy the same code via a Linux VM everything works fine.

Very odd

@paulycloud
Copy link
Author

paulycloud commented Nov 6, 2018

@mnapoli and @g87andres, Is there anything that can be done for people with windows machines? I would really love to get this working.

@mnapoli
Copy link
Member

mnapoli commented Nov 6, 2018

@paulkamau2015 I have no idea as I do not work with Windows. We have to find a solution together :) Have you looked into the "serverless" project issues to see if there's an open issue there? Feel free to link interesting issues/links here so that others can investigate too.

@slootjes
Copy link

slootjes commented Nov 9, 2018

This is because the php binary needs to be given execute permissions which Windows is unable to do. The solution would be to deploy from a VM or container.

@mnapoli
Copy link
Member

mnapoli commented Nov 9, 2018

Right that seems like a lost cause, though I'm not a Windows expert :/

See adieuadieu/serverless-chrome#21 they seem to have the same problem (I guess they deploy the Chrome binary, and if you deploy from Windows the binary is missing the execution permissions).

Help is welcome!

@mnapoli mnapoli changed the title Execution error when the lambda is deployed from Windows Error when deployed from Windows Nov 9, 2018
@incoming-th
Copy link
Contributor

incoming-th commented Dec 4, 2018

Hi,

Just to unfortunately confirm the same bug. Just followed the sample on the readme and got "Internal server error" from API endpoint.

Then tested directly in lambda and this is what it is shown (not really helpful)

2018-12-04 003371

If this is permission issue from Windows then we need another way to deploy.

Did the exact same tests on Ubuntu and no issue during deploy command, which kind of confirm this is Windows related issue. Maybe create a docker during deployment process to help to deploy to Lambda?

@incoming-th
Copy link
Contributor

incoming-th commented Dec 5, 2018

Did more testings about this error using the Bref readme as sample.

Test 1
create in Windows and deploy from Windows => Internal server error

Test 2
create in Windows, use VirtualBox with LinuxMint with shared folder, deploy from Linux => Internal server error

Test 3
create in Windows, use VirtualBox with LinuxMint with shared folder, copy files into linux, deploy from Linux => Internal server error

Test 4
create in Linux, deploy from Linux => Success

Test 5
create in Windows, deploy from Windows adding the "mode" parameters in serverless.yml as discussed in this thread => Internal server error
I have checked the serverless doc and there is no reference to this "mode" variable (Serverless.yml Reference)

Will continue to investigate as it is important to be able to use Bref from any OS to help having more people interested in it. But for now the best for Windows user (like me) is to develop in dual-boot or use VirtualBox with Ubuntu or LinuxMint or any other flavor to directly develop your app.

@incoming-th
Copy link
Contributor

More investigations by comparing a ZIP from Windows not working and a ZIP from Linux working.

I think the issue is in the exec flag not set from a Windows ZIP on the php binary and the opcache modules.

@mnapoli Should we continue to investigate this issue or will it be resolved if you change the logic to use a layer in lambda?

2018-12-05 003372

2018-12-05 003373

2018-12-05 003374

@mnapoli
Copy link
Member

mnapoli commented Dec 5, 2018

@mnapoli Should we continue to investigate this issue or will it be resolved if you change the logic to use a layer in lambda?

Yes so in #99 I check out AWS SAM and this is a serious alternative to Serverless. I think it's very likely v0.3 of Bref goes that way. However I don't know if SAM works on Windows?

https://github.com/mnapoli/bref-bootstrap-benchmarks uses SAM btw if you want to try it out.

@incoming-th
Copy link
Contributor

@mnapoli I did not try the 0.3 yet, but for what I read this should resolve this issue once and for all. Correct?

@mnapoli
Copy link
Member

mnapoli commented Dec 19, 2018

At the moment it's not stable at all. But I don't know if AWS SAM is compatible with Windows. If it is then yes it will probably work much better.

@mnapoli
Copy link
Member

mnapoli commented Jan 5, 2019

AWS SAM seems to be compatible with Windows so v0.3 should solve the problem (https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html).

@mnapoli mnapoli added this to the 0.3 milestone Jan 19, 2019
@mnapoli
Copy link
Member

mnapoli commented Jan 19, 2019

I'll close this for now since 0.3 should fix this. If there are still issues let's open a separate issue because the whole discussion here will be obsolete (v0.3 changes a lot of things regarding deployment).

@mnapoli mnapoli closed this as completed Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants