https://pulumi.com logo
s

stale-knife-36790

04/08/2020, 12:43 PM
I can't seem to find the solution for a runtime/promisse error I'm having (with Pulumi's GCP module). This is my code (I pasted the code on the same hastebin page): https://hastebin.com/etajakubid.js
a

adorable-action-51248

04/08/2020, 1:50 PM
try if moving all functions into your lambda that you specific in HttpCallbackFunction
including the require statements
that should work πŸ˜‰
might be a bit extreme
f

faint-table-42725

04/08/2020, 3:52 PM
I don’t think you need the
const gs = require('./crud.js')
to be within the functions? I answered your GH issue with an example of moving the actual
@google-cloud/datastore
import within the function within one of the
crud.js
methods. Curious if that did not work for you?
s

stale-knife-36790

04/09/2020, 10:52 AM
@adorable-action-51248 @faint-table-42725 I did what you guys said and I made a 'barebones' version but it still doesn't seem to work. Code + Output: https://hastebin.com/ogebubinib.js
if you look at example they use callback factory
may be that helps
s

stale-knife-36790

04/10/2020, 10:02 AM
@adorable-action-51248 I got a deployment failure:
Copy code
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`gen_package_lock` had stderr output:\nnpm ERR! Maximum call stack size exceeded\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-04-09T12_17_01_397Z-debug.log\n\nerror: `gen_package_lock` returned code: 1", "errorType": "InternalError", "errorId": "F9FB3220"}}
a

adorable-action-51248

04/10/2020, 10:04 AM
😞 how does your code look like ?
s

stale-knife-36790

04/10/2020, 10:07 AM
@adorable-action-51248 https://hastebin.com/omitazoyah.js
Pretty empty
a

adorable-action-51248

04/10/2020, 10:13 AM
nvm
πŸ˜‰
s

stale-knife-36790

04/10/2020, 10:15 AM
? πŸ€”
@adorable-action-51248 you are making me curious now.
a

adorable-action-51248

04/10/2020, 10:15 AM
you need to return the app
πŸ˜„
s

stale-knife-36790

04/10/2020, 10:18 AM
🀦
Updating now
Then I need to look how I require/deploy an extra file (next to index.js)
-index.js -crud.js
a

adorable-action-51248

04/10/2020, 10:23 AM
contents of the functions are deployed via pulumi up. i think crud.js is picked up from node modules.
automatically.
s

stale-knife-36790

04/10/2020, 10:23 AM
But it isn't a node module though
mmh..
good question.
s

stale-knife-36790

04/10/2020, 10:23 AM
It's a .js file
a

adorable-action-51248

04/10/2020, 10:23 AM
then
give it a shot ? πŸ˜„
you can first deploy with out it
and without the require of course
and then see if that works.
and then second step add the require in
and then check if the packaging picks it up
s

stale-knife-36790

04/10/2020, 10:25 AM
Did that with my previous code, required it as you normally would but didn't work. 'Main' from package.json only accepts 1 file so that's also a no go. πŸ˜•
Couldn't require index.js and crud.js
If it would be possible it would upload both
a

adorable-action-51248

04/10/2020, 10:26 AM
without crud.js it works right ?
s

stale-knife-36790

04/10/2020, 10:34 AM
Apparantly not:
Copy code
Diagnostics:
  gcp:cloudfunctions:Function (pulumi-test):
    error: 1 error occurred:
        * creating urn:pulumi:dev::gcp::gcp:cloudfunctions:CallbackFunction$gcp:cloudfunctions/function:Function::pulumi-test: Error waiting for Creating CloudFunctions Function: Error code 3, message: Build failed: Build error details not available

  pulumi:pulumi:Stack (gcp-dev):
    error: update failed

    The Pulumi runtime detected that 34 promises were still active
    at the time that the process exited. There are a few ways that this can occur:
      * Not using `await` or `.then` on a Promise returned from a Pulumi API
      * Introducing a cyclic dependency between two Pulumi Resources
      * A bug in the Pulumi Runtime
    Leaving promises active is probably not what you want. If you are unsure about
    why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
    environment variable. The Pulumi runtime will then print out additional
    debug information about the leaked promises.
@adorable-action-51248
a

adorable-action-51248

04/10/2020, 10:54 AM
do you get this for preview or only when you deploy ?
s

stale-knife-36790

04/10/2020, 11:14 AM
@adorable-action-51248 when I deploy it
a

adorable-action-51248

04/10/2020, 11:34 AM
weird
i used the code and was able to deploy it
after adding the return statement. πŸ˜‰
how does your package.json look like ?
s

stale-knife-36790

04/10/2020, 11:44 AM
Copy code
{
  "name": "gcp",
  "main": "index.js",
  "dependencies": {
    "@pulumi/gcp": "^2.0.0",
    "@pulumi/pulumi": "^1.0.0",
    "express": "^4.17.1",
    "allCrud": "file:."
  }
}
(Currently not using 'allCrud' @adorable-action-51248)
a

adorable-action-51248

04/10/2020, 11:45 AM
you are missing body-parser in the requirements
but the error message should look different.
i wonder if allCrud messes with pulumi
s

stale-knife-36790

04/10/2020, 12:10 PM
@adorable-action-51248 I know this sounds weird but the file is getting all node_modules from another folder (I make a 'switch' that chooses which api to deploy on which platform)
So it's getting the node modules from the actual root instead of that folder
a

adorable-action-51248

04/10/2020, 4:16 PM
ah.
that’s the normal node resolution
you can just run npm install in the gcp folder right ?
that should create the node_modules right there
s

stale-knife-36790

04/14/2020, 9:04 AM
@adorable-action-51248 alright, so, status update: It does now deploy (emptied npm's cache and installed the latest pulumi version) and now it does deploy however I now get "Error Forbidden, your client does not have permission to get URL /pulumi-test-7777c9b/ from this server". It looks like GCP still does run into a npm error.
This is the output of GCP
Deployment failure:
Copy code
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`gen_package_lock` had stderr output:\nnpm ERR! Maximum call stack size exceeded\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-04-14T08_50_30_907Z-debug.log\n\nerror: `gen_package_lock` returned code: 1", "errorType": "InternalError", "errorId": "79DA4BF7"}}
a

adorable-action-51248

04/14/2020, 9:18 AM
mmh. weird errors. may be someone of pulumi could help with these ?
@stale-knife-36790 there are EU office-hours now πŸ˜„
s

stale-knife-36790

04/14/2020, 9:27 AM
@adorable-action-51248 What's that for? πŸ€”
a

adorable-action-51248

04/14/2020, 9:28 AM
may be those guys can help you with your problem πŸ˜„
since they are from pulumi and might have seen the issue.
s

stale-knife-36790

04/14/2020, 9:30 AM
Thanks! I just joined! Otherwhise I might tag a pulumi staff member in this thread ^^
🍻 2