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

"local" command broken #17

Closed
t-geindre opened this issue Jun 12, 2018 · 5 comments
Closed

"local" command broken #17

t-geindre opened this issue Jun 12, 2018 · 5 comments
Labels

Comments

@t-geindre
Copy link
Contributor

t-geindre commented Jun 12, 2018

Hi,

I've just updated bref to version 0.2.13 with opcache support added by #14.

And now the bref local command isn't working anymore.

Before the update, the handler.js ran the php command without any argument. It used to work fine but since you've added a php.ini defining a specific extensions directory, my local binary fail to load extensions, including opcache.so.

I am wondering if I'm using the local command the right way or if I'm missing something?

Or is there really an issue here?

Here is an output example:

$ vendor/bin/bref local
Invoking the lambda
 7/7 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 20 secs

In Process.php line 223:
                                                                                                                                                                                                                                             
  The command "serverless invoke local -f 'main'" failed.                                                                                                                                                                                    
                                                                                                                                                                                                                                             
  Exit Code: 1(General error)                                                                                                                                                                                                                
                                                                                                                                                                                                                                             
  Working directory: .bref/output                                                                                                                                                                                                            
                                                                                                                                                                                                                                             
  Output:                                                                                                                                                                                                                                    
  ================                                                                                                                                                                                                                           
  [STDERR] PHP Warning:  Failed loading Zend extension 'opcache.so' (tried: /var/task/.bref/bin/ext/opcache.so (/var/task/.bref/bin/ext/opcache.so: cannot open shared object file: No such file or directory), /var/task/.bref/bin/ext/opc  
  ache.so.so (/var/task/.bref/bin/ext/opcache.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
@mnapoli
Copy link
Member

mnapoli commented Jun 12, 2018

Oh right! I need to add tests for this.

I'm working on that today.

@mnapoli mnapoli added the bug label Jun 12, 2018
@mnapoli
Copy link
Member

mnapoli commented Jun 12, 2018

Please try 0.2.14 and let me know!

@t-geindre
Copy link
Contributor Author

t-geindre commented Jun 12, 2018

It works! Thank you for the quick fix.

So you've added an env variable allowing different behaviors according to whether it's defined or not.

Is there plan to add more different behaviors according to this variable?

I'm thinking about loading different serverless.yml for exemple, as the source for my env variables might not be the same in production and local env. And maybe a different .bref.yml as the build might also be different according to the current environment.

@mnapoli
Copy link
Member

mnapoli commented Jun 12, 2018

We could add more behavior.

However for environment variables I think it might be better to use something like .env (DotEnv) files when running locally. That will avoid reinventing the wheel.

But also the more I think about it, the more I think it doesn't make a lot of sense to run the lambda in .bref/output. After all the dev environment is setup correctly, we could simply run the lambda in the project directory, that would also be similar to CLI and HTTP invocations:

  • HTTP: run using php -S 127.0.0.1 bref.php
  • CLI: run using php bref.php <arguments>
  • direct invocation: run using ?

And that way the dev environment is always the same, no need to be locked-in Bref specific stuff.

I have an idea, I'll open a pull request to discuss that.

@mnapoli
Copy link
Member

mnapoli commented Jun 12, 2018

I've opened #22 with that idea.

jvis pushed a commit to jvis/bref that referenced this issue Nov 1, 2018
brefphp-bot pushed a commit to brefphp-bot/bref that referenced this issue Nov 18, 2021
Add executable permission to the script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants