aaronpowell / azure-remix-stack Goto Github PK
View Code? Open in Web Editor NEWA remix stack template for running a remix app on Azure
License: MIT License
A remix stack template for running a remix app on Azure
License: MIT License
The infra/main.parameters.json
and infra/app/web.parameters.json
have the value of $(secretOrRandomPassword)
for the databasePassword
and sessionSecret
parameters.
If one does not already have a Azure KeyVault setup with those two secrets, azd
will generate two different random passwords for the databasePassword
and sessionSecret
parameters. This causes the app container
resource to have the incorrect database password and the remix app will fail to login with the default credentials with a bad username/password error.
@aaronpowell having issues getting past the DB connection and migration.
Im using sqlexpress and when it asks for the local connection string I am using the following:
sqlserver://localhost\sql2019;initialCatalog=remixAzure;integratedSecurity=true;trustServerCertificate=true;
Hoever I get the following error every time. I have tried with SA password as well. Is there something that I am doing wrong?
Error: Migration engine error:
Error creating a database connection.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! remixAzure-180a@ setup:db: prisma migrate dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the remixAzure-180a@ setup:db script.
Bug Description
When I deployed this repo to Azure using azd up
as recomended in the /prisma/seed.ts
file, I get the error below. For some reason the remix app is unable to connect to the postgresql instance when it is running in Azure.
Steps to reproduce:
azd
with the azd login --use-device-code
command.azd up
and answer the questions in the following dialog.Endpoint
and try to log in with the credentials provided in the README.Console Error:
2023-01-21T05:14:45.78782 Successfully Connected to container: 'main' [Revision: 'ca-web-zpj7g4hsn3q5e--33qs0uf', Replica: 'ca-web-zpj7g4hsn3q5e--33qs0uf-8486759696-2g887']
2023-01-21T05:13:27.144270489Z
2023-01-21T05:13:27.144274861Z Can't reach database server at `psql-db-zpj7g4hsn3q5e.postgres.database.azure.com`:`5432`
2023-01-21T05:13:27.144278759Z
2023-01-21T05:13:27.144283149Z Please make sure your database server is running at `psql-db-zpj7g4hsn3q5e.postgres.database.azure.com`:`5432`.
2023-01-21T05:13:27.144287778Z at RequestHandler.handleRequestError (/myapp/node_modules/@prisma/client/runtime/index.js:34316:13)
2023-01-21T05:13:27.144291493Z at RequestHandler.request (/myapp/node_modules/@prisma/client/runtime/index.js:34293:12)
2023-01-21T05:13:27.144295489Z at PrismaClient._request (/myapp/node_modules/@prisma/client/runtime/index.js:35273:16)
2023-01-21T05:13:27.144299564Z at verifyLogin (/myapp/build/index.js:111:26)
2023-01-21T05:13:27.144303596Z at action2 (/myapp/build/index.js:479:14)
2023-01-21T05:13:27.144306942Z at Object.callRouteAction (/myapp/node_modules/@remix-run/server-runtime/dist/data.js:35:14)
2023-01-21T05:13:27.144310339Z at handleDataRequest (/myapp/node_modules/@remix-run/server-runtime/dist/server.js:116:18)
2023-01-21T05:13:27.144313941Z at requestHandler (/myapp/node_modules/@remix-run/server-runtime/dist/server.js:48:18)
2023-01-21T05:13:27.144317795Z at /myapp/node_modules/@remix-run/express/dist/server.js:39:22 {
2023-01-21T05:13:27.144321674Z clientVersion: '4.6.1',
2023-01-21T05:13:27.144325256Z errorCode: undefined
2023-01-21T05:13:27.144329396Z }
2023-01-21T05:13:27.146333004Z POST /login?_data=routes%2Flogin 500 - - 5045.256 ms
2023-01-21T05:13:27.229181638Z GET /login?_data=root 200 - - 1.297 ms
2023-01-21T05:14:44.818299223Z GET /login?_data=routes%2Flogin 200 - - 2.002 ms
2023-01-21T05:14:44.819928833Z GET /login?_data=root 200 - - 0.999 ms
2023-01-21T05:15:17.502527331Z PrismaClientInitializationError:
2023-01-21T05:15:17.502560236Z Invalid `prisma.user.findUnique()` invocation:
2023-01-21T05:15:17.502565036Z
2023-01-21T05:15:17.502569184Z
2023-01-21T05:15:17.502573770Z Can't reach database server at `psql-db-zpj7g4hsn3q5e.postgres.database.azure.com`:`5432`
2023-01-21T05:15:17.502577328Z
2023-01-21T05:15:17.502583345Z Please make sure your database server is running at `psql-db-zpj7g4hsn3q5e.postgres.database.azure.com`:`5432`.
2023-01-21T05:15:17.502586974Z at RequestHandler.handleRequestError (/myapp/node_modules/@prisma/client/runtime/index.js:34316:13)
2023-01-21T05:15:17.502590850Z at RequestHandler.request (/myapp/node_modules/@prisma/client/runtime/index.js:34293:12)
2023-01-21T05:15:17.502594398Z at PrismaClient._request (/myapp/node_modules/@prisma/client/runtime/index.js:35273:16)
2023-01-21T05:15:17.502598911Z at verifyLogin (/myapp/build/index.js:111:26)
2023-01-21T05:15:17.502603695Z at action2 (/myapp/build/index.js:479:14)
2023-01-21T05:15:17.502607903Z at Object.callRouteAction (/myapp/node_modules/@remix-run/server-runtime/dist/data.js:35:14)
2023-01-21T05:15:17.502611587Z at handleDataRequest (/myapp/node_modules/@remix-run/server-runtime/dist/server.js:116:18)
2023-01-21T05:15:17.502631731Z at requestHandler (/myapp/node_modules/@remix-run/server-runtime/dist/server.js:48:18)
2023-01-21T05:15:17.502635831Z at /myapp/node_modules/@remix-run/express/dist/server.js:39:22 {
2023-01-21T05:15:17.502641064Z clientVersion: '4.6.1',
2023-01-21T05:15:17.502645171Z errorCode: undefined
2023-01-21T05:15:17.502649064Z }
2023-01-21T05:15:17.504787869Z POST /login?_data=routes%2Flogin 500 - - 5005.932 ms
2023-01-21T05:15:17.594855249Z GET /login?_data=root 200 - - 1.197 ms
The default configuration leads to errors when trying to execute line 26 of the Dockerfile:
curl -fsSL https://aka.ms/install-azd.sh | bash
on Apple Silicon Macs. As a workaround, I removed that line to be able to spin up the devcontainer. After it was running, I connected to it, downloaded the linux-arm64 azd binary and placed it in /usr/local/bin. This should be a suitable workaround for others facing the same problem.
First thanks a lot for this! I'm not in prod yet, but looking really great so far.
I've followed the Remix tutorial steps with the azure stack. I could not start my server:
npm run dev
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /home/martin/code/beeo/beeoutstanding-remix/node_modules/headers-polyfill/package.json
After some tests I find that the "root culprit" was the msw package. Upgrading from 0.39 to 0.47 (latest) made it work with npm v17
I can provide a (one line) PR if interested.
Hi,
When using the template with the latest version of remix (2.2.0) and then updating the Dockerfile to node:19-alpine the deployment just stays on the nginx landing page.
I'm not sure where to debug from there if you can point that out it'd be a great help? We're using Azure through foundershub so would prefer to stay with Azure which is made easier with your template (thank you!!) but still challenging!
Andrew
When trying to build the Docker image, I get the following error:
#9 71.55 > postinstall
#9 71.55 > npx remix setup node
#9 71.55
#9 71.71 npm WARN using --force Recommended protections disabled.
#9 71.91 npm ERR! could not determine executable to run
#9 71.91
#9 71.91 npm ERR! A complete log of this run can be found in:
#9 71.91 npm ERR! /root/.npm/_logs/2022-07-08T08_54_42_835Z-debug-0.log
#9 71.92 npm notice
#9 71.92 npm notice New minor version of npm available! 8.11.0 -> 8.13.2
#9 71.92 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.13.2>
#9 71.92 npm notice Run `npm install -g [email protected]` to update!
#9 71.92 npm notice
#9 71.92 npm ERR! code 1
#9 71.92 npm ERR! path /myapp
#9 71.92 npm ERR! command failed
#9 71.92 npm ERR! command sh -c npx remix setup node
#9 71.93
#9 71.93 npm ERR! A complete log of this run can be found in:
#9 71.93 npm ERR! /root/.npm/_logs/2022-07-08T08_53_31_411Z-debug-0.log
------
executor failed running [/bin/sh -c npm install --force --unsafe-perm]: exit code: 1
How can I fix this?
As we've been accepted into the Microsoft Founders Hub, I am now looking into the migration path we can take to move from Fly.io to Azure.
I've tried following the steps, but when running the provisioning steps I get the following output:
(main) [1] % azd provision ~/Sites/azure/azure-notes-app
Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time
You can view detailed progress in the Azure Portal:
https://portal.azure.com/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/%2Fsubscriptions%2F7016d301-b77a-4084-83ed-f61ec4c3c495%2Fproviders%2FMicrosoft.Resources%2Fdeployments%2Fazure-notes-app-1684586540
(✓) Done: Resource group: rg-azure-notes-app
(✓) Done: Log Analytics workspace: log-6pdjv6yqsrp3w
(✓) Done: Application Insights: appi-6pdjv6yqsrp3w
(✓) Done: Portal dashboard: dash-6pdjv6yqsrp3w
(✓) Done: Container Apps Environment: cae-6pdjv6yqsrp3w
(x) Failed: Azure Database for PostgreSQL flexible server: psql-db-6pdjv6yqsrp3w
(✓) Done: Container Registry: cr6pdjv6yqsrp3w
ERROR: deployment failed: failing invoking action 'provision', error deploying infrastructure: deploying to subscription:
Deployment Error Details:
InternalServerError: An unexpected error occured while processing the request. Tracking ID: '2adc0978-33cc-48b6-b4fc-359447d4b1e8'
| | Creating/Updating resourcesTraceID: 06dd6919ecb123e5efee779f15834831
{ "code": "DeploymentFailed", "target": "/subscriptions/7016d301-b77a-4084-83ed-f61ec4c3c495/resourceGroups/rg-azure-notes-app/providers/Microsoft.Resources/deployments/db-remix", "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.", "details": [ { "code": "ResourceDeploymentFailure", "target": "/subscriptions/7016d301-b77a-4084-83ed-f61ec4c3c495/resourceGroups/rg-azure-notes-app/providers/Microsoft.DBforPostgreSQL/flexibleServers/psql-db-6pdjv6yqsrp3w", "message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.", "details": [ { "code": "InternalServerError", "message": "An unexpected error occured while processing the request. Tracking ID: '2adc0978-33cc-48b6-b4fc-359447d4b1e8'" } ] } ] }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.