amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

"FeatureFlags is not initialized" when running `amplify api migrate`

Open thomasklein-winemaker opened this issue 4 years ago • 17 comments

Before opening, please confirm:

  • [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm install -g @aws-amplify/cli@latest

If applicable, what version of Node.js are you using?

v16.13.0

Amplify CLI Version

8.2.0

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Amplify Categories

api

Amplify Commands

Not applicable

Describe the bug

After updating amplify-cli from 4.27 to 8.2.0 running amplify api migrate I end up with the error FeatureFlags is not initialized. I was able to run amplify push afterwards without problems, so it does not seem to be related to https://github.com/aws-amplify/amplify-cli/issues/7068

I already re-installed amplify just to rule out any leftovers from the big versions bump, however, same result.

My <root>/amplify/cli.json:

{
  "features": {
    "graphqltransformer": {
      "addmissingownerfields": false,
      "improvepluralization": false,
      "validatetypenamereservedwords": true,
      "useexperimentalpipelinedtransformer": false,
      "enableiterativegsiupdates": false,
      "secondarykeyasgsi": false,
      "skipoverridemutationinputtypes": false,
      "transformerversion": 1,
      "suppressschemamigrationprompt": true,
      "securityenhancementnotification": true,
      "showfieldauthnotification": false,
      "usesubusernamefordefaultidentityclaim": false,
      "securityEnhancementNotification": false
    },
    "frontend-ios": {
      "enablexcodeintegration": false
    },
    "auth": {
      "enablecaseinsensitivity": false,
      "useinclusiveterminology": false,
      "breakcirculardependency": false,
      "forcealiasattributes": false,
      "useenabledmfas": false
    },
    "codegen": {
      "useappsyncmodelgenplugin": false,
      "usedocsgeneratorplugin": false,
      "usetypesgeneratorplugin": false,
      "cleangeneratedmodelsdirectory": false,
      "retaincasestyle": false,
      "addtimestampfields": false,
      "handlelistnullabilitytransparently": false,
      "emitauthprovider": false,
      "generateindexrules": false,
      "enabledartnullsafety": false
    },
    "appsync": {
      "generategraphqlpermissions": false
    },
    "latestregionsupport": {
      "pinpoint": 0,
      "translate": 0,
      "transcribe": 0,
      "rekognition": 0,
      "textract": 0,
      "comprehend": 0
    },
    "project": {
      "overrides": true
    }
  }
}

Expected behavior

The migration process to start.

Reproduction steps

amplify api migrate

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line
2022-05-12T12:17:05.889Z|info : amplify migrate api
2022-05-12T12:17:05.932Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}

Additional information

No response

thomasklein-winemaker avatar May 12 '22 13:05 thomasklein-winemaker

Hey @thomasklein-winemaker :wave: thank you for taking the time to file this! While your cli.json looks great, can you confirm whether this error continuously pops up on subsequent amplify migrate api attempts? If you also run amplify update api, does it prompt to migrate the resource and is that also experiencing the same issue?

josefaidt avatar May 12 '22 14:05 josefaidt

Hi Josef!

this error continuously pops up on subsequent amplify migrate api attempts

Yes it does.

...does it prompt to migrate the resource...

no, no prompt to migrate. Instead

amplify update api 
? Select from one of the below mentioned services: GraphQL
General information
- Name: backend
- API endpoint: https://xxx.appsync-api.eu-central-1.amazonaws.com/graphql

Authorization modes
- Default: Amazon Cognito User Pool
- IAM

Conflict detection (required for DataStore)
- Disabled

? Select a setting to edit (Use arrow keys)
> Authorization modes 
> Enable conflict detection (required for DataStore)

From here I didn't continue as neither option seems to solve my problem.

thomasklein-winemaker avatar May 12 '22 14:05 thomasklein-winemaker

Is there any way I could run the command with a more verbose output? I couldn't find the option in the cli's flags.

thomasklein-winemaker avatar May 12 '22 18:05 thomasklein-winemaker

I encounter the same problem 'FeatureFlags is not initialized'

johannchen2021 avatar May 13 '22 02:05 johannchen2021

Hey @thomasklein-winemaker and @johannchen2021 can you post the latest snippet from your logs in ~/.amplify/logs?

josefaidt avatar May 13 '22 19:05 josefaidt

Sadly, not very enlightening.

2022-05-13T20:38:27.517Z|info : amplify migrate api  
2022-05-13T20:38:27.565Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}

thomasklein-winemaker avatar May 13 '22 20:05 thomasklein-winemaker

We're hitting the same problem. The logs are the same too.

jasonxh avatar May 14 '22 16:05 jasonxh

Is it a way to bypass the migration? I just want to override the default dynamodb table and point to a different table (backup table) for my amplify app. I got this error when I ran amplify override api "The GraphQL API is using transformer version 1. Run amplify migrate api to upgrade to transformer version 2 and rerun amplify override api to enable override functionality for API"

johannchen2021 avatar May 15 '22 13:05 johannchen2021

I tried to add a new env, and hoped that it would default to transformer version 2. However it automatically created the api resources with transformer version 1. Is it a way to make a new env with default to transformer version 2? Do I need to remove the amplify folder first before I create a new env?

johannchen2021 avatar May 15 '22 13:05 johannchen2021

Hey @thomasklein-winemaker , @jasonxh , and @johannchen2021 I was able to reproduce this issue on amplify migrate api using the following steps:

  1. use Amplify CLI 8.2.0
  2. run amplify init -y
  3. run amplify add api > Accept defaults > Blank schema
  4. change transformerversion feature flag to 1
  5. change useexperimentalpipelinedtransformer feature flag to false
  6. add the following to your schema.graphql
    type Todo @model {
      name: String!
      completed: Boolean!
    }
    
  7. run amplify push -y
  8. run amplify migrate api
  9. observe error
    > amplify migrate api
    
    The following types do not have '@auth' enabled. Consider using @auth with @model
      - Todo
    Learn more about @auth here: https://docs.amplify.aws/cli-legacy/graphql-transformer/auth
    
    GraphQL schema compiled successfully.
    
    Edit your schema at /path/to/my/project/amplify/backend/api/gqlmigrate/schema.graphql or place .graphql files in a directory at /path/to/my/project/amplify/backend/api/gqlmigrate/schema
    🛑 FeatureFlags is not initialized
    

Marking this as a bug 🙂

josefaidt avatar May 19 '22 13:05 josefaidt

I also just see the error "FeatureFlags is not initialized" when running 'amplify api migrate'. I update the cli fairly regularly so the problem is likely not caused by an update from a really old version. Any solutions or work-arounds would be greatly appreciated.

jladdison avatar May 20 '22 01:05 jladdison

I've also came across the same issue as @jladdison said above. Any help is appreciated!

jonatantibarovsky avatar May 20 '22 09:05 jonatantibarovsky

I have this same issue

Thierry0 avatar May 20 '22 12:05 Thierry0

+1

mnikolic10 avatar May 23 '22 10:05 mnikolic10

Experiencing this issue after being prompted to migrate api and auth during a push (and accepting/deploying those migrations). However the local schema and other files were never migrated, and now getting FeatureFlags is not initialized when trying to run amplify migrate api anyway to get this to run to auto migrate those files?

JrPribs avatar May 23 '22 15:05 JrPribs

This issue should be fixed by this commit: https://github.com/aws-amplify/amplify-category-api/commit/5bd81fd2160bd619b3d10a382444598cea4f41f8 and the next release should address the error

pavellazar avatar May 23 '22 15:05 pavellazar

Thanks @lazpavel @josefaidt. Can confirm it's working for me now.

mnikolic10 avatar May 24 '22 03:05 mnikolic10