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

symfony cloud:environment:debug results in "An error occurred while adding APP_ENV" #408

Open
roland-w-2024 opened this issue Jan 7, 2024 · 6 comments

Comments

@roland-w-2024
Copy link

I just read about “Debugging Production Deployments before Deploying” in “The Fast Track”: https://symfony.com/doc/6.2/the-fast-track/en/11-branch.html#debugging-production-deployments-before-deploying

When I call symfony cloud:env:debug or symfony cloud:environment:debug an error is shown:

➜  guestbook git:(sessions-in-db) symfony cloud:environment:debug --verbose
Setting APP_ENV and APP_DEBUG to dev/debug (can take some time, --debug to tail commands)
                                          
  An error occurred while adding APP_ENV  
                                          

Error trace:
                                          
  An error occurred while adding APP_ENV  
                                          

github.com/symfony-cli/symfony-cli/commands.glob..func3
	github.com/symfony-cli/symfony-cli/commands/cloud_env_debug.go:95
github.com/symfony-cli/console.(*Command).Run
	github.com/symfony-cli/console@v1.0.3/command.go:156
github.com/symfony-cli/console.(*Application).Run
	github.com/symfony-cli/console@v1.0.3/application.go:147
main.main
	symfony-cli/main.go:128
runtime.main
	runtime/proc.go:267
runtime.goexit
	runtime/asm_arm64.s:1197

Note: I use Symfony CLI version 5.7.8 and Symfony 7.0.2 with PHP 8.2.14 on my Laptop.

@fabpot
Copy link
Contributor

fabpot commented Jan 9, 2024

In c4e4083, I have made the error message more explicit so that you can see what's happening. Apparently, the env var already exists.

@fabpot fabpot closed this as completed Jan 9, 2024
@roland-w-2024
Copy link
Author

roland-w-2024 commented Jan 9, 2024

If the ev var already exists, the Symfony Debug Toolbar should be shown, right? It does not on the page when I execute symfony cloud:url -1. And using the --off flag to remove the env var results in "Variable not found":

➜  guestbook git:(sessions-in-db) ✗ symfony cloud:env:debug --verbose
Setting APP_ENV and APP_DEBUG to dev/debug (can take some time, --debug to tail commands)
                                          
  An error occurred while adding APP_ENV  
                                          

Error trace:
                                          
  An error occurred while adding APP_ENV  
                                          

github.com/symfony-cli/symfony-cli/commands.glob..func3
	github.com/symfony-cli/symfony-cli/commands/cloud_env_debug.go:95
github.com/symfony-cli/console.(*Command).Run
	github.com/symfony-cli/console@v1.0.3/command.go:156
github.com/symfony-cli/console.(*Application).Run
	github.com/symfony-cli/console@v1.0.3/application.go:147
main.main
	symfony-cli/main.go:128
runtime.main
	runtime/proc.go:267
runtime.goexit
	runtime/asm_arm64.s:1197
➜  guestbook git:(sessions-in-db) ✗ symfony cloud:env:debug --off --verbose
Deleting APP_ENV and APP_DEBUG (can take some time, --debug to tail commands)
                                            
  An error occurred while removing APP_ENV  
                                            

Error trace:
                                            
  An error occurred while removing APP_ENV  
                                            

github.com/symfony-cli/symfony-cli/commands.glob..func3
	github.com/symfony-cli/symfony-cli/commands/cloud_env_debug.go:69
github.com/symfony-cli/console.(*Command).Run
	github.com/symfony-cli/console@v1.0.3/command.go:156
github.com/symfony-cli/console.(*Application).Run
	github.com/symfony-cli/console@v1.0.3/application.go:147
main.main
	symfony-cli/main.go:128
runtime.main
	runtime/proc.go:267
runtime.goexit
	runtime/asm_arm64.s:1197
➜  guestbook git:(sessions-in-db) ✗ symfony cloud:env:debug --verbose      
Setting APP_ENV and APP_DEBUG to dev/debug (can take some time, --debug to tail commands)
                                          
  An error occurred while adding APP_ENV  
                                          

Error trace:
                                          
  An error occurred while adding APP_ENV  
                                          

github.com/symfony-cli/symfony-cli/commands.glob..func3
	github.com/symfony-cli/symfony-cli/commands/cloud_env_debug.go:95
github.com/symfony-cli/console.(*Command).Run
	github.com/symfony-cli/console@v1.0.3/command.go:156
github.com/symfony-cli/console.(*Application).Run
	github.com/symfony-cli/console@v1.0.3/application.go:147
main.main
	symfony-cli/main.go:128
runtime.main
	runtime/proc.go:267
runtime.goexit
	runtime/asm_arm64.s:1197

Is there something wrong with my platform.sh environmant or is it the Symfony CLI that causes it?

@fabpot
Copy link
Contributor

fabpot commented Jan 9, 2024

As the error is coming from line 95, it means that the env var already exists.

What's the output of symfony cloud:var:list -c name --format=plain?

And if the var exists, can you paste the output of symfony cloud:var:get env:APP_ENV?

@fabpot fabpot reopened this Jan 9, 2024
@roland-w-2024
Copy link
Author

roland-w-2024 commented Jan 9, 2024

➜  guestbook git:(sessions-in-db) ✗ symfony cloud:env:debug --verbose            
Setting APP_ENV and APP_DEBUG to dev/debug (can take some time, --debug to tail commands)
                                          
  An error occurred while adding APP_ENV  
                                          

Error trace:
                                          
  An error occurred while adding APP_ENV  
                                          

github.com/symfony-cli/symfony-cli/commands.glob..func3
	github.com/symfony-cli/symfony-cli/commands/cloud_env_debug.go:95
github.com/symfony-cli/console.(*Command).Run
	github.com/symfony-cli/console@v1.0.3/command.go:156
github.com/symfony-cli/console.(*Application).Run
	github.com/symfony-cli/console@v1.0.3/application.go:147
main.main
	symfony-cli/main.go:128
runtime.main
	runtime/proc.go:267
runtime.goexit
	runtime/asm_arm64.s:1197
➜  guestbook git:(sessions-in-db) ✗ symfony cloud:var:list -c name --format=plain
No variables found.
                 
  exit status 1  
                 
➜  guestbook git:(sessions-in-db) ✗ symfony cloud:var:get env:APP_ENV            
Variable not found: env:APP_ENV
                 
  exit status 1  

@fabpot
Copy link
Contributor

fabpot commented Jan 9, 2024

Sorry I forgot to ask you to add the debug flag: symfony cloud:env:debug --verbose --debug

@roland-w-2024
Copy link
Author

➜  guestbook git:(sessions-in-db) ✗ symfony cloud:env:debug --verbose --debug
odo57sr35ebb4
main
 ◒  
Setting APP_ENV and APP_DEBUG to dev/debug (can take some time, --debug to tail commands)

                                                               
  [CommandNotFoundException]                                   
  There are no commands defined in the "cloud:var" namespace.  
                                                               

                                          
  An error occurred while adding APP_ENV  
                                          

Error trace:
                                          
  An error occurred while adding APP_ENV  
                                          

github.com/symfony-cli/symfony-cli/commands.glob..func3
	github.com/symfony-cli/symfony-cli/commands/cloud_env_debug.go:95
github.com/symfony-cli/console.(*Command).Run
	github.com/symfony-cli/console@v1.0.3/command.go:156
github.com/symfony-cli/console.(*Application).Run
	github.com/symfony-cli/console@v1.0.3/application.go:147
main.main
	symfony-cli/main.go:128
runtime.main
	runtime/proc.go:267
runtime.goexit
	runtime/asm_arm64.s:1197

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

No branches or pull requests

2 participants