Package from local module not being found "cannot find module providing package" - google-app-engine

I've been upgrading my app engine site to go112. The go app (with package github.com/a/main.go) is using a number of sub packages in a folder called api (github.com/a/api/) and another called server. These sub packages use other dependencies.
When I run go vet, go build everything seems to be just fine.
When I deploy the app to app engine the build process fails (using Cloud Build). The output shows that a package from the api folder cannot be found. When remove the references to that package, the build fails on another package from the server folder.
The curious thing is that it my own code that cannot be found by the compilation on app engine
It is as if all of the sub packages are not being 'uploaded', but I cannot understand why.
I've run go mod init and go build ./... without any issues.

Related

How to Host a React App with 3D .gltf files?

I want to ask on how can I host my react app. It is a 3d product configurator.
I tried to host it on AWS Amplify but the 3d models doesnt load
If you want to host an application on aws amplify you have to create a build version of your app (assuming that it works already without any start issues meaning that you have a functional react app created with the command npx create-react-app).
Usually your react app runs on local host and it's basically like a test/development version of your app. When you take it into aws it really wants a build version of your app. The build command will generate everything you need for this. Navigate to your react application folder and
Run the command
npm run build
This will create a folder that you can send to aws amplify.
When you go to the aws amplify site it'll ask you if you would like to build a website or host a website.
Select host and then it'll ask if you would like to push it from a repository like github. For now lets just skip it and keep the deployment as simple as possible. Deploy without git for now.
Next, we want to click on drag and drop so that you can manually select the file build folder that your npm run build command generated.
Look for the build folder that was generated and drag that folder into the aws area. You don't actually have to click the 'choose files button'. Sometimes the box glitches and won't let you drag anything outside of the box. So what you can do is just open up your directories and manually find that build file in your folders. Drag it from there to the aws zone at the bottom of the screen.
Give your AWS app a name and env name.
From there you can deploy. Once you deploy it'll give you a site address. Also before you make your build, be sure that all of the packages you need are installed. I had an issue where my axiom commands were not working because I had not installed it prior to pushing my build.
So if your project depends on a certain npm package to run your .gltf files make sure that it is installed on your application. You should see it inside the node modules folder (in your apps local directory not the aws one).
I think AWS uses the node modules folder to generate everything your project needs (But I am not 100% sure of this). But it didn't work prior to me installing the package and pushing the build folder again to aws via drag and drop.
There are better ways to do this but this is what worked for me! Hope this helps to at least get your site up and running. Also hope it helps with any package issues that might have been happening with your 3d models. This is about as far as I can take you. Good luck!

Embedding react application's build into Drupal

Primarily, I'm trying to integrate a react application (Created and build separately) with Drupal.
Problem
Unable to install private package from Bitbucket using npm install git#bitbucket.org:user/shared-package.git in Drupal app, because no package.json found.
Implementation Details
Development Environment
To achieve this in development environment I run npm run build which produces the following content in dist directory.
Not going in the details of what are the roles of other files but to make the things work, I just need to copy bundle.js file and paste it inside a directory under app/web/themes/custom/abc_themes/js/.
This is okay for development environment to copy a folder from one project and paste it into another. However, for production environment it' not viable.
Production Environment
In production we thought to create a private package on Bitbucket, where through Bitbucket pipelines on every commit we trigger a build and push that build 's result into a separate repo (i.e. private package).
Here is the content that is pushed to the so-called private package. Since it's the entire react application (not a library) therefore when it builds it creates compiled js and doesn't contain packgae.json.
Now if I try to install this package throught npm install
code ENOLOCAL
npm ERR! Could not install from "bitbucket.org:user/shared-package.git" as it does not contain a package.json file.
That is obvious but to solve this I can't convert my project into a library. Because even if I convert it to a library, Drupal needs a build js file at the specified directory to work.
Expectation
Want to know if there is a way I could install that private package (that doesn't have package.json) into Drupal application.
OR any other way around to achieve the same.
NOTE: I know one solution could be to host the build file at some CDN and pull it from there. But problem is, the Drupal app might be running behind a corporate network and users won't be able to access the internet openly. Therefore, we want to make the react app a part of build process, so once Drupal is served, react application would be a part of it already. No loading at runtime.

How to deploy React.js application that makes server calls to IIS?

Really new to web dev. so forgive me if this is a simple issue...
I want to host a React application on Microsoft IIS. This application makes server calls: this is the project I am trying to do https://www.twilio.com/blog/react-app-with-node-js-server-proxy)
What happens when I link the build to IIS is that I'm able to type something in the form, but I'm unable to see a response from the application (the fetch call is being made but is failing and nothing is returned). When I run npm run dev in the project folder the form works as it should, so it appears that the server isn't being hosted(?).
to deploy react application in iis follow below steps:
1)run below command to build the site:
npm run build
the above command creates a build folder inside your application folder.
2)now open iis manager.right-click on the server node and select create new site.
provide site binding detailed and set the folder path of the site to the build folder which is generated by the command.
https://stackoverflow.com/a/60110712/11147346

How to build react.js apps at visual studio code?

I have created two apps using 'Visual Studio Code' and 'node.js.' I run them using command 'npm start,' and they show in the browser. I want to build them or deploy them so they can be used by anyone. It says there to use command 'npm run build.' How to do that, and what technique you use in order to build them?
It depends on what configuration you used for building the React app. If you used create-react-app, npm run build is the correct command for building it.
If you used a different configuration (e.g. webpack), you should use the relevant command for that configuration.
Either way, deploying it will be as easy as copy/pasting the build folder's content to the server you want to host it, after running the build command.
Visual Studio Code or any other Code Editor for that matter is not relevant. You can develop, build and deploy any React app using any Code Editor you want, it's just a matter of preference.
"Building" refers to the task of preparing (transforming, minifying, compressing, etc.) all the relevant project files so that they're ready for production (assuming that your build scripts are configured to do so).
"Deploying" an app is usually a separate task that will deploy (upload) your current project build to a development platform provider like Firebase, Netlify, Azure, etc. Note that you have to register with a provider and setup a new project on their end before your deploy your project.
Which provider you use is totally up to you. Also, you have to configure your current project once you've chosen your development provider. They'll provide instructions on how to deploy your project.
On a side note, keep in mind that you can configure your own npm scripts so that they run whatever you want. More about that here

I can't deploy a Go module to App Engine using the google.golang.org/appengine modules

From the latest material I can read, and also based on documentation on certain APIs (for example, the Go Datastore API), I'm supposed to use google.golang.org/appengine etc. instead of the old appengine/... paths. However, when I try to deploy using gcloud preview app deploy, I get the following error:
Deployment contains files that cannot be compiled: Compile failed:
2016/01/14 14:32:43 go-app-builder: build timing: 2×6g (113ms total), 0×6l (0 total)
2016/01/14 14:32:43 go-app-builder: failed running 6g: exit status 1
server/alexa.go:10: can't find import: "golang.org/x/net/context"
The golang.org/x/net/context package supposedly replaces the old appengine/context one, but it doesn't appear to be available in the deployment server's GOROOT.
I tried including all the dependencies and their dependencies in my package repo but that only lead me to this obscure error (the directory it's complaining about actually exists):
Deployment contains files that cannot be compiled: Compile failed:
2016/01/14 14:27:04 go-app-builder: build timing: 18×6g (1.819s total), 0×6l (0 total)
2016/01/14 14:27:04 go-app-builder: failed running 6g: exit status 1
github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go:27: can't find import: "github.com/golang/protobuf/protoc-gen-go/testdata/multi"
Have I misunderstood the documentation and am only supposed to use the old packages?
You need to do a go get golang.org/x/net/context to save that package in your go src directory. Though, when working with App Engine it is not necessary. Those libraries can be imported and used, but they mostly focused on applications run outside of App Engine, i.e. Container Engine or Compute Engine. They essentially hook into the RESTful APIs Google cooked up for those services. If you decide to work directly with Google Cloud Storage you would need those libraries since App Engine expects you to use Blobstore instead. Hope this helps.
If you are using gosdk, just run goapp get in the same directory as your .go file and it will download and install the dependencies to your gosdk installation. You then deploy the app again and it should compile without problem.
When it's working there's no prompt and files will be downloaded to gosdk\gopath\src
After fininshing there will be a warning message which can be ignored:
go install: no install location for directory
C:\your_current_directory outside GOPATH
For more details see: go help gopath
For the record, this issue is now fixed with gcloud version 142.
One should now be able to deploy using gcloud beta app deploy --project <project> app.yaml. Use gcloud components update to upgrade the command line.
Here is an example project to see it work: https://github.com/aubm/my-test-app
And the Travis build logs: https://travis-ci.org/aubm/my-test-app/builds/198057096

Resources