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

after mock, constantly inserts "aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true, #2569

Open
3 tasks done
ggcespia opened this issue May 13, 2024 · 3 comments
Labels
bug Something isn't working pending-response

Comments

@ggcespia
Copy link

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Not applicable

Amplify Version

v5

Amplify Categories

Not applicable

Backend

Amplify CLI

Environment information

# Put output below this line
 System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 3.61 GB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
    Yarn: 1.22.15 - /usr/local/Cellar/node/16.9.1/bin/yarn
    npm: 8.1.3 - /usr/local/Cellar/node/16.9.1/bin/npm
  Browsers:
    Chrome: 124.0.6367.201
    Firefox: 38.0.5
    Safari: 15.6.1
  npmPackages:
    @aws-amplify/pubsub: ^5.0.7 => 5.0.12 
    @aws-amplify/ui-react: ^4.3.6 => 4.3.6 
    @aws-amplify/ui-react-internal:  undefined ()
    @aws-sdk/client-lambda: ^3.540.0 => 3.540.0 
    @babel/core: ^7.12.9 => 7.20.12 
    @babel/plugin-proposal-export-namespace-from: ^7.18.9 => 7.18.9 
    @expo/metro-config: ^0.5.1 => 0.5.2 
    @expo/vector-icons: ^13.0.0  => 13.0.0 
    @expo/webpack-config: ^18.0.1 => 18.0.1 
    @react-native-async-storage/async-storage: ^1.17.3 => 1.17.11 
    @react-native-community/netinfo: 9.3.0 => 9.3.0 
    @react-native-community/slider: ^4.4.2 => 4.4.2 
    @react-native-picker/picker: 2.4.2 => 2.4.2 (1.16.8)
    @react-navigation/bottom-tabs: ^6.2.0 => 6.5.4 
    @react-navigation/material-bottom-tabs: ^6.1.1 => 6.2.12 
    @react-navigation/native: ^6.0.8 => 6.1.3 
    @react-navigation/native-stack: ^6.5.2 => 6.9.9 
    @react-navigation/stack: ^6.3.12 => 6.3.12 
    @stripe/react-stripe-js: ^1.16.2 => 1.16.4 
    @stripe/stripe-js: ^1.46.0 => 1.46.0 
    @types/react: ~18.0.24 => 18.0.27 
    @types/react-native: ~0.70.6 => 0.70.10 
    @typescript-eslint/eslint-plugin: ^5.55.0 => 5.55.0 
    @typescript-eslint/parser: ^5.55.0 => 5.55.0 
    HelloWorld:  0.0.1 
    aws-amplify: ^5.0.12 => 5.0.12 
    axios: ^1.6.7 => 1.6.7 (0.26.0)
    babel-eslint: ^10.1.0 => 10.1.0 
    c3: ^0.7.20 => 0.7.20 
    color: ^4.2.3 => 4.2.3 (3.2.1)
    eslint: ^8.57.0 => 8.57.0 
    eslint-config-universe: ^11.2.0 => 11.2.0 
    eslint-plugin-react-hooks: ^4.6.0 => 4.6.0 
    expo: ~47.0.8 => 47.0.13 
    expo-clipboard: ~4.0.1 => 4.0.1 
    expo-constants: ~14.0.2 => 14.0.2 
    expo-document-picker: ^11.0.1 => 11.0.1 
    expo-image-manipulator: ^11.0.0 => 11.0.0 
    expo-image-picker: ^14.0.2 => 14.1.0 
    expo-linking: ^3.2.3 => 3.3.0 
    expo-localization: ~14.0.0 => 14.0.0 
    expo-splash-screen: ~0.17.5 => 0.17.5 
    expo-status-bar: ~1.4.2 => 1.4.2 
    graphql: ^14.7.0 => 14.7.0 (15.8.0)
    graphql-tag: ^2.12.6 => 2.12.6 
    hermes-inspector-msggen:  1.0.0 
    i18n-js: ^3.9.2 => 3.9.2 
    jquery: ^3.6.1 => 3.6.3 
    lodash.keys: ^4.2.0 => 4.2.0 
    lodash.memoize: ^4.1.2 => 4.1.2 
    object-hash: ^3.0.0 => 3.0.0 
    prettier: ^2.8.4 => 2.8.4 
    prop-types: ^15.8.1 => 15.8.1 
    react: 17.0.1 => 17.0.1 (16.14.0)
    react-color: ^2.19.3 => 2.19.3 
    react-datetime-picker: ^4.0.1 => 4.2.0 
    react-dom: 17.0.1 => 17.0.1 (16.14.0)
    react-hook-form: ^7.28.1 => 7.43.0 
    react-native: 0.64.3 => 0.64.3 
    react-native-draggable-flatlist: ^4.0.0 => 4.0.0 
    react-native-gesture-handler: ^2.8.0 => 2.9.0 
    react-native-paper: github:ggcespia/react-native-paper => 4.12.5 
    react-native-picker-select: ^8.0.4 => 8.0.4 
    react-native-reanimated: ~2.12.0 => 2.12.0 
    react-native-safe-area-context: 4.3.1 => 4.3.1 
    react-native-screens: ~3.15.0 => 3.15.0 
    react-native-svg: 12.3.0 => 12.3.0 
    react-native-web: ~0.17.1 => 0.17.7 
    react-native-web-refresh-control: ^1.1.1 => 1.1.1 
    react-rnd: ^10.3.7 => 10.4.1 
    react-scale-text: ^1.2.2 => 1.2.2 
    react-tag-autocomplete: ^6.3.0 => 6.3.0 
    react-zlib-js: ^1.0.5 => 1.0.5 
    setimmediate: ^1.0.5 => 1.0.5 
    shortid: ^2.2.16 => 2.2.16 
    styled-components: ^6.1.8 => 6.1.8 
    styled-components/native:  undefined ()
    typescript: ^4.6.3 => 4.9.5 
    uuid: ^9.0.0 => 9.0.0 (3.4.0, 8.3.2, 7.0.3)
  npmGlobalPackages:
    @aws-amplify/api: 4.0.48
    @aws-amplify/cli: 12.10.3
    eas-cli: 0.53.1
    expo-cli: 6.1.0
    express-generator: 4.16.1
    express: 4.18.1
    lerna: 6.5.1
    n: 9.2.1
    node-html-to-image-cli: 1.1.1
    react-devtools: 4.28.4
    sharp-cli: 3.0.0
    sof_cli: 1.0.0
    tsc: 2.0.4

Describe the bug

I used amplify mock function once. Now, every time I do an amplify push --y - it keeps putting back in

"aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true,

in my amplifyconfiguration.json and was-exports.js

I saw an old bug with this, but am unable to find it again - it was closed as fixed. Clearly it isn't fixed, as it keeps happening. I am using cli version 12.10.3

Expected behavior

Not to put the mock "aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true in the config files.

Reproduction steps

delete "aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true, from the 2 config files
amplify mock function
amplify push --y
"aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true
shows back up again in the config files.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

Where does one notify the 'mock' engine to stop mocking? With the dangerously_connect options, all of my GraphQL subscriptions stop working.

@ggcespia
Copy link
Author

Is there some setting I can disable to make this stop doing this? I don't see any "mock cleanup" or the like. Is there some value in a json file I can tweak?

@ggcespia
Copy link
Author

ggcespia commented May 17, 2024

After looking at the Amplify source and grep'ing my drive for testMode, I found amplify/backend/amplify-meta.json - where testMode: true was put in there under my api.output (most likely from the mock command). I set that to false and now, the ..dangerously.. values do not get reinstated. Obviously, this isn't the 'clean' way to do this, but until someone fixes the code to somehow shut off that testMode value, this worked for me.
"api": {
"myapiname": {
"output": {
...
"testMode": false <- this was true when generating the offending aws_appsync_dangerously_connect_to_http_endpoint_for_testing
}
}
}

@chrisbonifacio
Copy link

chrisbonifacio commented May 20, 2024

Hi @ggcespia can you confirm whether this behavior occurs in development or in production? What should happen in prod is that the CLI regenerates the config with testMode being false by default.

Transferring this to amplify-category-api for better support as it is a build-time issue

@chrisbonifacio chrisbonifacio transferred this issue from aws-amplify/amplify-js May 20, 2024
@phani-srikar phani-srikar added bug Something isn't working and removed pending-triage labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending-response
Projects
None yet
Development

No branches or pull requests

4 participants