cc: <@U01FB721J8N> <@U3D8LQ8HK> <@ULP250DRT> Hi, ...
# orm-help
g
cc: @Alex Ruheni @nikolasburk @janpio Hi, everyone! I had some issues when I decided to update to version 3.12.0 to build my application using Azure Functions with GitHub Actions. So, to fix this issue, I had to downgrade to 3.11.0 as you can see here: https://github.com/glaucia86/azuresql-prisma-talk/blob/main/.github/workflows/azure-static-web-apps-mango-sky-0a5cbaf1e.yml#L36 And here the commits with changes https://github.com/glaucia86/azuresql-prisma-talk/commit/cb514e1e01ff1ee060932c231e5fba828828cbc8 https://github.com/glaucia86/azuresql-prisma-talk/commit/03b86980eead1b2f8ec5e55d5a643348af765554 Any ideia what it should be?
a
Hey Glaucia 👋🏽 You don’t have to specify the Prisma version in your GitHub workflow.
npx prisma generate
would work just fine. You would only have to update the Prisma version in your
package.json
file. Could you clarify what errors you were experiencing on upgrading to the latest version?
You can specify the path to your Prisma schema using
Copy code
`prisma generate --schema=./path/to/your/schema.prisma` to generate Prisma Client.
This could have something to do with Oryx in the build step 🤔
j
I assume you mean the failures here @Glaucia Lemos: https://github.com/glaucia86/azuresql-prisma-talk/actions Correct?
Seems https://github.com/glaucia86/azuresql-prisma-talk/runs/5841511557?check_suite_focus=true was still fine, and then https://github.com/glaucia86/azuresql-prisma-talk/runs/5841682034?check_suite_focus=true started to fail:
Copy code
> @prisma/client@3.12.0 postinstall /github/workspace/api/.oryx_prod_node_modules/node_modules/@prisma/client
> node scripts/postinstall.js

Prisma schema loaded from ../prisma/schema.prisma

✔ Generated Prisma Client (3.12.0 | library) to ./../node_modules/@prisma/client in 94ms
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient()
Copy code
> api@1.0.0 postinstall /github/workspace/api/.oryx_prod_node_modules
> prisma generate

sh: 1: prisma: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! api@1.0.0 postinstall: `prisma generate`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the api@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2022-04-05T21_58_23_802Z-debug.log


---End of Oryx build logs---
Oryx has failed to build the solution.
That looks like it was triggered by the commit under test though, it added this new script that is failing: https://github.com/glaucia86/azuresql-prisma-talk/commit/13edc850e26c28044e7b19208a6f6230c332cbfb
The following commit (also fails on CI) removed most of the scripts, but not the
postinstall
and the
prisma.schema
property from
oackage.json
- which was not a valid path
Then a removal of the left over
postinstall
and
prisma.schema
made the build succeed
Afterwards you change the versions - but it is not obvious to me why. CI was green before.
On the other hand: It is good practice to pin an exact version in the package.json (so without the
^
) so it installs exactly what is in there.
You could do that, but hten the upgrade from 3.11.0 to 3.12.0 should cause no trouble at all, at least not in your project.
g
So... the workflow will always give a green sign
But when you try to return values, nothing happen and appear this message for me:
Copy code
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.GetEmployees
 ---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Result: Failure
Exception: Worker was unable to load function GetEmployees: 'Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>'
Stack: Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>
    at new PrismaClient (/home/site/wwwroot/node_modules/.prisma/client/index.js:3:11)
    at Object.<anonymous> (/home/site/wwwroot/shared/prisma.js:10:16)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/site/wwwroot/GetEmployees/index.js:8:16)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
   at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters, FunctionInvocationContext context) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 96
   at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionInvokerBase.cs:line 82
   at Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.Coerce[T](Task`1 src) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionGenerator.cs:line 225
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 596
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 544
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 322
   at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters, FunctionInvocationContext context) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 96
   at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionInvokerBase.cs:line 82
   at Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.Coerce[T](Task`1 src) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionGenerator.cs:line 225
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 596
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 544
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 322
   --- End of inner exception stack trace ---
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 369
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 108
cc: @Alex Ruheni @janpio
so.. after to include that npx command inside the yaml file... wow! Works beautifully and brought all the informations again
again... the build will definitely work. But... will not bring all the informations from the Front-End side. I had to include that command to works pretty fine again
If you want to schedule a call meeting with me to simulate this issue, please ping me anytime
j
Interesting. We should be able to reproduce this when forking the repo, the latest commit (with
@3.11.1
in the script) should work, and then when we remove that, it would not work any more?
g
No. Just with that command inside the yaml file. If you want to we can schedule a call meeting to simulate this error
cc: @janpio
j
Difficult to organize right now unfortunately for me. But I will fork your repo, let the action run (which should succeed right now) and then I can open a PR where I remove the version (which should make it fail, right)?
https://github.com/glaucia86/azuresql-prisma-talk/pull/6 You will need to approve once in GH Actions so this can run.