Apollo-client with parcel warnings - apollo

Have been trying to setup apollo-client with parcel for my react app. Things work fine but in the console, there are plenty of warnings regarding missing source files in node_modules/apollo-client in my CI pipeline.
Have tried clearing yarn cache, removing node_modules and installing again. But the warnings are persistent. I might be missing something with parcel or babel configuration. Found few hints but they were webpack specific.
Following are the logs:
⚠️ Could not load source file "../../src/data/store.ts" in source map of "../node_modules/apollo-client/data/store.js".
⚠️ Could not load source file "../../src/util/Observable.ts" in source map of "../node_modules/apollo-client/util/Observable.js"
.
⚠️ Could not load source file "../../src/core/QueryManager.ts" in source map of "../node_modules/apollo-client/core/QueryManager.js".
⚠️ Could not load source file "../../src/data/mutations.ts" in source map of "../node_modules/apollo-client/data/mutations.js".
⚠️ Could not load source file "../../src/scheduler/scheduler.ts" in source map of "../node_modules/apollo-client/scheduler/scheduler.js".
⚠️ Could not load source file "../../src/data/queries.ts" in source map of "../node_modules/apollo-client/data/queries.js".
⚠️ Could not load source file "../../src/errors/ApolloError.ts" in source map of "../node_modules/apollo-client/errors/ApolloError.js".
⚠️ Could not load source file "../../src/core/networkStatus.ts" in source map of "../node_modules/apollo-client/core/networkStatus.js".
⚠️ Could not load source file "../src/ApolloClient.ts" in source map of "../node_modules/apollo-client/ApolloClient.js".
⚠️ Could not load source file "../../src/core/ObservableQuery.ts" in source map of "../node_modules/apollo-client/core/ObservableQuery.js".
⚠️ Could not load source file "../src/index.ts" in source map of "../node_modules/apollo-client/index.js".
⚠️ Could not load source file "../../src/core/types.ts" in source map of "../node_modules/apollo-client/core/types.js"

I ran into the same problem when setting up apollo-client with parcel for my react app (and am not using typescript). While I get the same warnings, the app does compile and does work. If I understand the situation correctly, parcel is trying to resolve sourcemaps from node_modules, but is not finding them correctly in the case of apollo-client.
An easy workaround to suppress the warnings is to add a simple tsconfig.json file to your project root:
./tsconfig.js
{
"exclude": [
"./node_modules",
"**/*.spec.ts"
]
}

The cause for this problem is that parceljs tries to find the source files from the source maps. The files are existent you can check that by simply looking into the distributed folder. I do not know why the warnings are shown. However you are not alone with that problem see: https://github.com/parcel-bundler/parcel/issues/2185
To suppress the warnings you can use a CLI option: --log-level 1. However keep in mind that you will suppress all warnings, which I do not recommend!
If anyone is coming across the error: Property name expected type of string but got null you can use the following options to solve that problem: npx parcel watch ./server/src/YOUR_SOURCE_INDEX --out-dir ./YOUR_DESTINATION --no-hmr --target node
Also there is an issue for that too: https://github.com/apollographql/apollo-server/issues/2453

Related

LNK1181 Error while compiling the core after adding a module

I'm trying to compile my core with some modules but i'm getting the following error when building worldserver:
cannot open input file '..\..\..\modules\RelWithDebInfo\modules.lib' worldserver
This error only happens when compiling with the mod-gain-honor-guard module. I've installed a repack before that came with this module pre-installed, which makes me think that i'm the one missing something.
Any ideas?
Thanks!
I've compiled the core succesfully with only one module, then i've added the one mentioned before and that error came up. CMake didn't show me any error when i regenerated the source for building after adding the module
You always need to regenerate the source in CMake when you add or remove any files to the source.
Did you get the module via git clone? If not, and it's a direct download, you need to remove the -master or any other branch name from the folder name.

Protoc Output Directory Issue - No Such File or Directory

I recently finished the basic tutorial for C++ here and wanted to set up a project based on the proto files from here. I followed a similar directory structure as the tutorial and changed up the CMakeLists.txt file to accommodate the new files.
I'm currently trying to just compile the manager.proto file. I was able to compile the file and get my server/client files, however the files are being outputted within cmake/build/minknow_api rather than the expected cmake/build folder. This meant the make command would return the error:
clang: error: no such file or directory: '/Users/name/Documents/grpc/examples/cpp/minknow_api/cmake/build/manager.grpc.pb.cc'
clang: error: no input files
I read that it was because protoc outputs based on the imports of the proto file, i.e the file comes with import minknow_api/device.proto for instance. I copied the files from within the cmake/build/minknow_api into cmake/build/ and reran make and it seemed to work, however, the C++ file imports as expected are searching within a minknow_api directory, meaning I'd have to manually edit these imports to look within the current directory instead of to then compile successfully.
I've tried experimenting with trying to get rid of the minknow_api from the proto imports, however had no luck and only got more import issues during compilation. It seems some files have the same names for messages etc, which means I had to keep the minknow.somename as the package so I can thus distinguish in the files which imported values I wanted to access. I've also tried moving files into their own directories like instance.proto which has package minknow.instance would go inside of instance directory, but still no luck.
I was wondering if anyone could figure out how to get rid of the minknow_api out of my proto imports properly so that I won't get these import and output directory issues down the track?

What is the type and files in artifacts, aws buildspec yaml file

I am a noob. What is the 'artifacts' in the buildsepc yaml file?
I read on https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started-create-build-spec-console.html,
"Artifacts represents the set of build output artifacts that CodeBuild uploads to the output bucket. files represents the files to include in the build output."
Maybe, I am not understanding it correctly. Given the settings in the screenshot above, I expect two zipped files(template.yml and outputtemplate.yml) to be uploaded to the output bucket, say BUCKET=MYBUCKET.
But, when I check my S3 bucket after I build and deploy it, I have 2 files named like c7e84f72729709f7a0.
Also, just to understand what's going on, I tried removing the lines: 'type: zip' and '-template.yml', and built and deployed again. I expected only 1 file since I removed line 8 and 10. But, the result was still two files sitting in my bucket. What exactly are the artifacts? And What is the type?(this I can't even find any documentations). Why is the type in most cases, if not always, zip? when in fact the uploaded file is not actually not a zip file?
Thank you.
The file c7e84f72729709f7a0 is your zip file. It will contain both yml files. Just unpack it as any other zip file. May need to add extension .zip if required by your unpacking software.
I don't know where the type: zip comes from. The reference docs for the buldspec.yml do not document such a field.
And artifacts are outcomes files of your build. For example, when you are building a C++ project, it would be executable or library files resulting from compilation of your C++ source code.
The artifices are also carried over to a next stage of your CI/CD pipeline, such as integration testing or deployment with CodeDeploy.
Just to add to Marcin's answer, the type property of artifacts was deprecated in version 0.2 (the one that's being used here). You can see the changes across buildspec versions at the bottom of this page.

Error while building WSO2 Microgateway project on Windows 10

I’ve been trying to explore WSO2 Microgateway and set up a Microgateway project. Building the project in Windows 10 with the command “micro-gw build project-name” is giving this error: “Could not find or load main class org.wso2.apimgt.gateway.cli.cmd.Main”.
I’ve downloaded the Toolkit and Runtime from https://wso2.com/api-management/api-microgateway/. I've set the Path environment variable to the /bin directory of the Toolkit and Runtime extracted folders, but still the “micro-gw build project-name” command is giving error “Could not find or load main class org.wso2.apimgt.gateway.cli.cmd.Main”. I’ve also cloned the source code from Github (https://github.com/wso2/product-microgateway/) which has the Main.java class and tried setting environment variables to its path.
I also tried setting the environment variables to the path where Toolkit batch file is present. I also followed the steps mentioned here, https://github.com/wso2/product-microgateway/#running-the-microgateway.
I'm assuming the Toolkit batch file (micro-gw) would execute the Main.java class coming up in the error.
These steps did not resolve the error. I'm new to Java based product, and I'm sure I'm missing something here.
Problem is with the init command not the build command. Init command is suppose to setup the TOOLKIT after the first use. It should extract the platform.zip file and copy all of the required resources to relevant places for you.
I hope you get the Project ___ successfully initialized message after running the init command. Just check $TOOLKIT_HOME/logs/ directory to see if there are any information on the log file.
If the log file also doesn't help, as a workaround, copy all the .jar files inside $TOOLKIT_HOME/lib/gateway/platform and $TOOLKIT_HOME/lib/gateway/cli to $TOOLKIT_HOME/lib/platform/bre/lib and try again, that should work.
Also please report this issue at https://github.com/wso2/product-microgateway/issues

VSTS Build defination fails at Get Sources step

VSTS Build definition fails at Get Sources step from TFS.
Below is the error:
"error]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException:
Exit code 1 returned from process: file name 'tf', arguments 'vc get
/version:131 /recursive /overwrite D:\a\3\s /loginType:OAuth
/login:.,*** /noprompt'."
Please help.
You might see this error when the changes that you are trying to check in contain a file/folder to a location that is not mapped to list of sources with the build definition.
Error message is not beautiful enough but it is there to stop accidental check-ins.
Scan through your pending changes and see if there is any file that is from a folder that is not mapped as a source folder in build definition.
If there is one, either add that path to build definition folder list or move the files into a folder that is mapped as source folder.
Close all projects.
2 Connect to your repository.
In pending changes do not filter by any project, just see all files which is it check-in.
Map and check-in files and folders.
Try to build again