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

When first using Lagoon integration users end up with a NULL key #3058

Closed
owenbush opened this issue Jun 24, 2021 · 1 comment
Closed

When first using Lagoon integration users end up with a NULL key #3058

owenbush opened this issue Jun 24, 2021 · 1 comment
Labels
bug Something aint working right! lagoon Deals with the Lagoon recipe

Comments

@owenbush
Copy link
Contributor

Tell us about your setup

What is your lando version and operating system?
v 3.1.4 on Mac OSX 11.4 (Big Sur)

Tell us about your .lando.yml

name: drupal-example-3
recipe: lagoon
config:
  flavor: drupal
  build:
    - composer install

Tell us about the command you were running

Paste in a series of commands that caused the bug.

Example:

lando pull

Tell us about the error you got

The first time I run lando pull I get prompted to create a key for Lagoon, which I do and I add to Lagoon successfully, the lando pull command finishes properly without issue. However, any lando command run afterwards, on any project throws the following error:

Example:

Unhandled rejection TypeError: Cannot read property 'email' of null
    at /snapshot/lando/build/cli/integrations/lando-lagoon/lib/keys.js
    at arrayMap (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:653:23)
    at Function.map (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:9622:14)
    at interceptor (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:17094:35)
    at thru (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:8859:14)
    at /snapshot/lando/build/cli/node_modules/lodash/lodash.js:4430:28
    at arrayReduce (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:697:21)
    at baseWrapperValue (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:4429:14)
    at LazyWrapper.lazyValue [as value] (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:1901:16)
    at baseWrapperValue (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:4427:25)
    at LodashWrapper.wrapperValue (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:9114:14)
    at LazyWrapper.lazyValue [as value] (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:1885:36)
    at baseWrapperValue (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:4427:25)
    at LodashWrapper.wrapperValue (/snapshot/lando/build/cli/node_modules/lodash/lodash.js:9114:14)
    at Object.getKeys (/snapshot/lando/build/cli/integrations/lando-lagoon/lib/keys.js)
    at Object.options (/snapshot/lando/build/cli/integrations/lando-lagoon/recipes/lagoon/init.js)
From previous event:
    at processImmediate (internal/timers.js:456:21)

It does not matter if it is the same project, or any specific Lagoon commands, this completely breaks Lando for all projects and all commands. lando --clear cannot even run.

Tell us generally about your bug

I tried to debug this for a while and I couldn't see any rhyme or reason for what was going on, until I paid closer attention to the ~/.lando/cache/lagoon.keys file, I noticed at the end of the file I had a null value.

[{"date":1624044644,"key":"/Users/owen/.lando/keys/lagoon-xxxx-xxxx-xxx-xxxx-xxxx@lagoon.amazeeio.cloud:32222","email":"owen.bush@lullabot.com"},null]

So, I removed that null and suddenly all Lando commands began working again. So, there seemed to be an issue with the initial creation of Lagoon keys in the Lando cache directory.

Tell us more

I began looking at the lando/cli code and set up lando.dev locally to test things out, I was able to isolate the bug and create a patch for it.

The problem exists in integrations/lando-lagoon/app.js on line 87:

app.lagoonKeys = lando.cache.get(app.lagoonKeyCache);

should in fact be

app.lagoonKeys = lando.cache.get(app.lagoonKeyCache) || [];

This is because when keys.sortKeys(app.lagoonKeys, [newKey]) is called, app.lagoonKeys is null and has not been initialized to be an empty array.

@owenbush owenbush added the bug Something aint working right! label Jun 24, 2021
owenbush added a commit to owenbush/cli that referenced this issue Jun 24, 2021
@pirog pirog added the lagoon Deals with the Lagoon recipe label Jun 30, 2021
pirog pushed a commit to lando/cli that referenced this issue Aug 23, 2021
@pirog
Copy link
Member

pirog commented Aug 23, 2021

@owenbush i merged this into the cli repo!

@pirog pirog closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something aint working right! lagoon Deals with the Lagoon recipe
Projects
None yet
Development

No branches or pull requests

2 participants